[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: special forms, take two (was Re: A lua version of "amb")
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 27 Feb 2012 06:59:44 +0200
>> Wouldn't a more Lua-like approach be to use a keyword "lambda" instead
>> of a symbol? I think my favourite syntax would be:
>> lambda x: x+1
>
> Yes, but the problem we're allegedly trying to solve is that many functional
> patterns are so bulky to express in Lua that nobody uses them. So the
> pendulum swings the opposite way, towards terseness, because under this
> hypothesis the lambda construct for procedure construction is so fundamental
> it needs short syntax, at least as short as table construction.
>
Lua's function syntax is fine, the keywords are just a bit, well, verbose.
The problem can be addressed at the lexer/parser level, since so many special
characters are still unused. For example.
'@' is a synonym for 'function'
'= is a synonym for 'return', as in the shell (unary '=')
'!' is a synonym for 'end'
Then
@(x)=x+1!
Not my idea -- the trick comes from an early version of the language
Turing.
Dirk
- References:
- A lua version of "amb", Xavier Wang
- special forms, take two (was Re: A lua version of "amb"), Jay Carlson
- Re: special forms, take two (was Re: A lua version of "amb"), steve donovan
- Re: special forms, take two (was Re: A lua version of "amb"), Jay Carlson
- Re: special forms, take two (was Re: A lua version of "amb"), steve donovan
- Re: special forms, take two (was Re: A lua version of "amb"), HyperHacker
- Re: special forms, take two (was Re: A lua version of "amb"), Jay Carlson