Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Slow, not sharing properly
- f :: Int -> [Int]
- f = \k -> let fk = f k
- -- first argument to zipWith is pointfree for sharing to work
- in (42 : 11*k+77 : zipWith (((+ (10*k)) .) . (-) . (*2)) (tail fk) fk)
- -- Fast, obviously not acceptable
- f1 = let fk = f1; k = 1 in (42 : 11*k+77 : zipWith (((+ (10*k)) .) . (-) . (*2)) (tail fk) fk)
- f2 = let fk = f2; k = 2 in (42 : 11*k+77 : zipWith (((+ (10*k)) .) . (-) . (*2)) (tail fk) fk)
- f3 = let fk = f3; k = 3 in (42 : 11*k+77 : zipWith (((+ (10*k)) .) . (-) . (*2)) (tail fk) fk)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement