[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lightweight syntax: a dissident view
- From: Eduardo Ochs <eduardoochs@...>
- Date: Sat, 27 Nov 2010 16:50:58 -0200
On Sat, Nov 27, 2010 at 7:19 AM, Dirk Laurie <dpl@sun.ac.za> wrote:
> 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.
Something like
(a,b,c,d) |-> (f,g,h),
with parentheses and "|->" (\mapsto), makes much more sense than
your proposal... in the preprint below this idea is taken to the extreme:
http://angg.twu.net/LATEX/2010diags.pdf
http://angg.twu.net/math-b.html#internal-diags-in-ct
The "dictionary trick" mentioned in the paper can be implemented
in Lua like this:
_G["a,b |-> a*b, a-b, {a, b}"] =
function (a,b) return a*b, a-b, {a, b} end
It is possible to recognize some kinds of "... |-> ..." names
automatically and make the compiler infer the corresponding
functions - that's a kind of "term inference" - but my impression
is that the class of terms that we would like the compiler/interpreter to
recognize is not bounded... we will always want it to recognize more,
and some of the terms that we would like to be recognizable are
going to contain ambiguities that are hard to resolve.
Cheers,
Eduardo Ochs
eduardoochs@gmail.com
http://angg.twu.net/
- 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
- Re: Lightweight syntax: a dissident view, Dirk Laurie