[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lightweight syntax: a dissident view
- From: Dirk Laurie <dpl@...>
- Date: Sat, 27 Nov 2010 11:19:10 +0200
On Sat, Nov 27, 2010 at 12:49:52AM +0200, Doug Lua wrote:
>
> \x,y,z(x*y+z) --> function(x,y,z) return x*y+z end
>
> It's concise and seems to have the fewest (zero?) ambiguities.
>
I'm starting to get the hang of this discussion. Nobody really
takes it seriously, but it's hard to resist the temptation to
chip in. Even I, who think there is zero chance of the developers
implementing anything seen so far, now succumb.
If all you want is a concise notation for mapping an m-tuple
of variables to an n-tuple of expressions, the standard way to
do it in mathematics is
$$ (a,b,c,d) \rightarrow (f,g,h) $$
(sorry for the TeX, but the Lua community will very shortly be
swelled by thousands of TeX users once LuaTeX is the standard).
The ASCII representation for that, taking into account that Lua
represents an m-tuple as a table, is
{a,b,c,d}->{f,g,h}
C programmers will have to suppress their instincts, but otherwise
it's not that unreadable.
In a numerical mathematics library, I might just be willing
to think of something like
integral, error = integrate({x}->{1/(1+x^4)},0,1)
as actually quite neat.
I'm not qualified to judge whether dropping the braces when m=1
or n=1 will complicate matters for the parser.
Dirk
- References:
- Re: Re: Re: Lightweight syntax: a dissident view, Axel Kittenberger
- Re: Lightweight syntax: a dissident view, Philippe Lhoste
- Re: Lightweight syntax: a dissident view, Pierre-Yves Gérardy
- Re: Lightweight syntax: a dissident view, Mark Hamburg
- Re: Lightweight syntax: a dissident view, Pierre-Yves Gérardy
- Re: Lightweight syntax: a dissident view, Pierre-Yves Gérardy
- Re: Lightweight syntax: a dissident view, Axel Kittenberger
- Re: Lightweight syntax: a dissident view, steve donovan
- Re: Lightweight syntax: a dissident view, phlnc8
- Re: Lightweight syntax: a dissident view, Doug Lua