1 2 3 4 5
cond p f g x = if p x then f x else g x take' = flip $ foldr (\x f -> (cond (>0) ((x:).f.pred) (const []))) (const []) main = print $ take' 2 [1, 2, 3]
1
[1,2]