[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Short function definition syntax; thoughts on Lua (was Re: [ANN] GSL Shell new beta release...)
- From: steve donovan <steve.j.donovan@...>
- Date: Sun, 6 Dec 2009 17:15:54 +0200
On Sun, Dec 6, 2009 at 5:37 AM, Pierre LeMoine <email@example.com> wrote:
>> A close form could already be implemented, without upvalues though:
>> local f = y[[ x + y with x, y ]]
> I think this looks rather nice actually. Doesn't seem like too much
> trouble to implement a such y-function and call it lambda or whatever
> catches one's fancy.
Oh it's not a difficult trick, can have local f = y "|x| x+y" as well.
But it does not capture upvalues, as pointed out (i.e. it cannot see
local variables in the current context) So no good for closures, but
for the little one-liners we were talking about it does fine.
This lua-users wiki page is very relevant to the short-form discussion: