Skip to content

Instantly share code, notes, and snippets.

@minhnhdo
Created January 1, 2012 13:03
Show Gist options
  • Save minhnhdo/1547281 to your computer and use it in GitHub Desktop.
Save minhnhdo/1547281 to your computer and use it in GitHub Desktop.
recursive natural number generator in Haskell
addStream :: (Num a) => [a] -> [a] -> [a]
addStream (x:xs) (y:ys) = x + y : addStream xs ys
natural :: [Integer]
natural = 1 : addStream natural (repeat 1)
@md2perpe
Copy link

md2perpe commented Jan 1, 2012

addStream = zipWith (+)

@minhnhdo
Copy link
Author

minhnhdo commented Jan 2, 2012

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment