Question: Write a non-recursive function with the following signature: uniq :: [ Char ] -> [ Char ] The function should take a list of characters
Write a non-recursive function with the following signature: uniq :: [ Char ] -> [ Char ] The function should take a list of characters and return a list with all duplicate items removed. That is, the returned value may contain at most one copy of each character. The order of the characters in the resulting list does not matter. * Main > uniq " hello , hero !" " helo , r !" * Main > uniq " ababababaaaab " " ab " The functions implementation must be expressed in terms of at least one of these higher-order functions: map, filter, and foldl. Hint: you can use the built-in elem function to determine if an item is in a list. The expression elem , a b will return True if the item a is in the list b. You can equivalently write the expression in infix notation as a elem b.
In Haskell
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
