It was thus said that the Great Fred Cisin once stated:
> Of
course, there are people who think if it doesn't look like C/C++, it
> ain't programmin'. :-) (Of course, not talking about you, Josh - just
> say lambda!)
On Tue, 3 Jan 2012, Richard wrote:
C++11 has lambda expressions.
Would yu use that for teaching programming to first-time beginners?
Personally, I would use Lua. It's small and nearly consistent [1] and
certainly one can write straight forward imperative code in it. But it also
supports recursion, lambda functions, closures and does tail call
optimizations. In fact, the Y combinator [2] can be written as:
function Y(f)
local function g(...) return f(g,...) end
return g
end
Also, World of Warcraft and nmap use Lua as a scripting language, so those
interested in gaming or network based exploits will learn a useful skill.
-spc (It's also very portable, being written in strict C-89 code)
[1] There's a bit of a mess with traditional arrays (besides being
1-based) in that:
a = { "one" , "two" , "three" }
has a length of 3, while
b = { "one" , "two" , nil , "four" }
is technically undefined. Such arrays can't have a nil value. It's
easy to work around and generally, I've never found it to be much of
an issue, but it does keep popping up on the Lua mailing list.
[2] Those that care will know what this does [3]; those that don't, will
probably never need to use this anyway.
[3] Allow an anonymous function to call itself.