LuaMacro $ lua52 luam -i
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
Lua Macro 2.3.0 Copyright (C) 2007-2011 Steve Donovan
> f = \x(x+1)
> = f(2)
3
LM defines a short function form based on a suggestion by lhf (a lexical macro system isn't clever enough to do |x|...)
Or even use a full-blown Lua-based language like MoonScript, which is particularly friendly for interactive work because the call operator has a very low precedence
$ mooni
MoonScript version 0.2.3
Note: use backslash at line end to start a block
> f = (x) -> x+1
> f 2
3
mooni is an experimental interactive version [2]. Sometimes problems make more sense with a more appropriate notation!
steve d.