flip is pretty easy:
if you have a function f :: a -> b -> c, then it flip fis a function :: b -> a -> c, so it returns a new function to you and reverses the order of the arguments you must pass.
(:) :: a -> [a] -> [a] , flip (:) , , :
(flip (:)) [2..4] 1
= (:) 1 [2..4]
= 1 : [2..4]
= [1,2,3,4]
, foldl :
foldl :: (b -> a -> b) -> b -> [a] -> b
- , , , ,
- :
myreverse [1..5]
= foldl (flip (:)) [] [1,2,3,4,5]
= foldl (flip (:)) (((flip (:)) [] 1)) [2,3,4,5]
= foldl (flip (:)) (1:[]) [2,3,4,5]
= foldl (flip (:)) (((flip (:)) [1] 2)) [3,4,5]
= foldl (flip (:)) (2:[1]) [3,4,5]
= ...
= [5,4,3,2,1]