Reputation: 2441
I don't understand what y <- [0..]
means here. Is it a variable definition?
f x = sum $ take 10 [x**y/product [1..y] | y <- [0..]]
Upvotes: 0
Views: 172
Reputation: 7835
this means a function taking x that returns the sum of ((x to the power of y) over y factorial for y ranging from 0 to 9).
Upvotes: 0
Reputation: 19223
A list comprehension. It can be interpreted as "for each y in [0..]".
Upvotes: 5