You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{--
accusesAll: A reuseable function that checks if a boy accuses all the boys in
the given list.
--}
accusesAll :: Boy -> [Boy] -> Bool
accusesAll x l = all (\b -> accuses x b) l
{--
Plus the list of boys who made honest (true) statements:
Result: [Matthew,Peter,Carl]
--}
honest :: [Boy]
honest = filter (\b -> accusesAll b guilty ) boys
Nice solution. The question which is left open:
Suppose a boy who accuses all the boys. Is he a honest boy? He certainly makes honest declarations.
The specification is not clear about this.
Well done!
The text was updated successfully, but these errors were encountered:
After processing the input data, we've build a grid based on logical statements given in the exercise:
As it is can be seen on the photograph, from the logical point of view, a boy who accuses everybody from the "guilty" list should be considered an honest person (Mathew, Peter, Carl), because by the conditions of the exercise, there are 3 boys who are always telling the truth. Therefore the two boys who don't accuse the guilty one(s), should be considered liars (Jack, Arnold).
By this logic, a boy who accuses everyone should be on the list of honest boys, because he is telling the truth about the guilty ones.
This is also directly stated in our solution:
honest :: [Boy]
honest = filter (\b -> accusesAll b guilty ) boys
Nice solution. The question which is left open:
Suppose a boy who accuses all the boys. Is he a honest boy? He certainly makes honest declarations.
The specification is not clear about this.
Well done!
The text was updated successfully, but these errors were encountered: