Operators
editExercises |
---|
|
1.
- Substitute
f
to getmap (\ x -> x * 2 + 3) xs
- Substitute
f
to getfoldr (\ x y -> read x + y) 1 xs
2.
(4+)
- Becomes
(\ x -> 4 + x)
- Has type
Num a => a -> a
- Becomes
(1 `elem`)
- Becomes
(\ x -> 1 `elem` x)
- Alternately written as
(\ x -> elem 1 x)
- Has type
Num a :: a -> Bool
- Note: The full type is
(Foldable t, Eq a, Num a) => t a -> Bool
but this has not been covered yet.
- Note: The full type is
- Becomes
(`notElem` "abc")
- Becomes
(\ x -> x `notElem` "abc")
- Alternately written as
(\ x -> notElem x "abc")
- Has type
Char -> Bool
- Becomes