Skip to content

Instantly share code, notes, and snippets.

@shugo
Created April 11, 2012 14:35
Show Gist options
  • Save shugo/2359698 to your computer and use it in GitHub Desktop.
Save shugo/2359698 to your computer and use it in GitHub Desktop.
Rubyでもzip_withでfibが書けた
require "immutable/stream"
include Immutable
fibs = Stream.cons{1}.tail {
Stream.cons{1}.tail {
fibs.zip_with(fibs.tail, &:+)
}
}
p fibs.take(10).to_list
@shugo
Copy link
Author

shugo commented Apr 11, 2012

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