在这个函数中:
play :: [Bool] -> ([Bool] -> Bool) -> ([Bool] -> Bool) -> [Bool]
play history agent1 agent2 = history ++ (agent1 history) ++ (agent2 history)
其中一名代理人可能是:
titForTat :: [Bool] -> Bool
titForTat history
| last history = True
| otherwise = False
我得到错误:
Couldn't match expected type `[Bool]' with actual type `Bool'
In the return type of a call of `agent1'
In the first argument of `(++)', namely `(agent1 history)'
In the second argument of `(++)', namely
`(agent1 history) ++ (agent2 history)'
在我看来,agent1 的返回类型应该是布尔值列表,但似乎有错误。如果这是一个非常初学者的问题,我很抱歉。谢谢