lua-users home
lua-l archive

Re: Re: Re: Lightweight syntax: a dissident view

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


<snip>
> > Would an explicit lambda keyword help?
> 
> not sure. What yould be the semantics of this? A lambda defining a one-expression function? Because, if you go
> 
> lambda(x) do something_with(x) end
<snip>
Sorry for jumping in late and following the discussion closely, but what about
not allowing statements and having something like below?
lambda `(' [parlist] `)' explist
I think this would cover most of the needs for a lightweight syntax. Taking a
recent snippet from Mark Hamburg, for example:
stream:map(lambda(x) x * x)
 :filter(lambda(x) x % 2 == 0)
 :subscribe(function(x)
 total = total + x
 log:writef("%d %d", x, total)
 end)
Cheers,
Luis
-- 
Computers are useless. They can only give you answers.
 -- Pablo Picasso
-- 
Luis Carvalho (Kozure)
lua -e 'print((("lexcarvalho@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'

AltStyle によって変換されたページ (->オリジナル) /