Actually, to me, it is the “local” command that reminds me of the
Lisp-ish let (despite the names). In Lisp (IIRC) “let” is a macro that
expands into a lambda form with the variables as formal arguments in the
lambda. This is exactly what the “local” method is doing. In fact, I
recall the Lisp “let” macro allows initial values to be specified as
well. To make the analogy complete, we could do …
arr.each {|i|
local(2i, i**2) { |a, b|
# a is initialized to 2i
# b is initialized to i**2
}
}