Skip to content

Instantly share code, notes, and snippets.

@tonyonodi
Created August 6, 2015 21:17
Show Gist options
  • Save tonyonodi/8038115527973154f1a6 to your computer and use it in GitHub Desktop.
Save tonyonodi/8038115527973154f1a6 to your computer and use it in GitHub Desktop.
// doesn't work for some reason
lambda {|n|
lambda {|fact_iter|
fact_iter(fact_iter, 1, 1)
}.call(lambda {|f_i, product, counter|
if counter > n
product
else
f_i(f_i, counter * product, counter + 1)
end
})
}.call(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment