rel1x
rel1x

Reputation: 2441

What does "y <- [0..]" mean?

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

Answers (2)

Mike H-R
Mike H-R

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

Guvante
Guvante

Reputation: 19223

A list comprehension. It can be interpreted as "for each y in [0..]".

Upvotes: 5

Related Questions