Skip to content

Instantly share code, notes, and snippets.

@mneedham
Created January 10, 2010 12:34
Show Gist options
  • Save mneedham/273473 to your computer and use it in GitHub Desktop.
Save mneedham/273473 to your computer and use it in GitHub Desktop.
let rec nums = seq { yield 1
for n in nums do yield n+1 }
How does this work?
When we call 'nums' on line 2 it recurses to the function again which means that on the first recursion the only value
in 'nums' is 1? So then we add the value 2 into the sequence presumably. Which means that if we recurse again then 1
and 2 will both be in the sequence. Not convinced I understand this very well...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment