Here’s an interesting post from Oreillynet.com. Did you know you can do this with Ruby out of the box?

# A real lambda
λ { puts ‘Hello’ }.call => ‘Hello’

# Sigma – sum of all elements
∑(1,2,3) => 6

# Square root
√ 49 => 7.0

How difficult was this to implement? Keep reading!

# Be sure to run with the “-Ku” flag!
module Kernel
alias λ proc

def ∑(*args)
sum = 0
args.each{ |e| sum += e }
sum
end

def √(root)
Math.sqrt(root)
end
end

Pretty tricky, eh?

Just remember the “-Ku”. :)

How I love Ruby On Rails Programming!