From: James Edward Gray II Date: 2007-03-01T10:35:43+09:00 Subject: Re: Functional programming in Ruby On Feb 28, 2007, at 4:20 PM, Brian Candler wrote: > puts proc { |n| > proc { |fact| fact.call(fact, n) }.call( > proc { |ft, k| > k <= 1 ? 1 : k * ft.call(ft, k-1) > } > ) > }.call(10) > proc { |*a| > proc { |iter| iter.call(iter, *a) }.call( > proc { |me, n, f| > if n >= 1 > f.call() > me.call(me, n-1, f) > end > } > ) > }.call(3, proc { puts "hello again" } ) Wow, those melted my brain. I kept thinking I could peel off the outer layer off the factorial one, but I didn't succeed. Wild stuff. Thanks for sharing. James Edward Gray II