
8 Jun
2010
8 Jun
'10
8:55 a.m.
Christopher Done wrote:
Can't forget fix in a game of code golf!
(fix $ \f (x:_: xs) -> x : f xs) [1..] => [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,4...
Ho, good shot! It only works for infinite lists, though: Prelude> (fix $ \f (x:_: xs) -> x : f xs) [1..10] [1,3,5,7,9*** Exception: <interactive>:1:7-30: Non-exhaustive patterns in lambda Regards, Yitz