lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Nov 22, 2010 at 4:32 AM, Axel Kittenberger <> wrote:
> @(=> _1 + _2, _1 * _2)
> is short for
> function(a,b) return a+b, a*b end
   In K / Q, if variable names are not given, it defaults to x, y, and
z (in the same sense you say _1, _2, _3). That seems like a good idea
to me, at least for rather short anonymous functions (e.g. "{x*x+y}"

   The bigger issue is that languages whose code typically has a lot
of anonymous functions (Lisp, ML, Haskell, etc.) are
/expression/-oriented rather than /statement/-oriented, making the
"return" implicit. fun(a,b) a+b, a*b end" wouldn't be too bad, though
it's probably not worth adding another reserved word. "@{x+y, x*y}",