4 ms·
fix :: (a -> a) -> a fix f = f (fix f) f :: [Int] -> [Int] f xs = 1 : map (*2) xs take 7 (fix f) ==> [1,2,4,8,16,32,64] Looks right to me.
by vq 4y ago
fix :: (a -> a) -> a
fix f = f (fix f)
f :: [Int] -> [Int]
f xs = 1 : map (*2) xs
take 7 (fix f) ==> [1,2,4,8,16,32,64]
Looks right to me.