3 ms·
Interpreting APL has a similar case: where a more verbose language would write something like: a+a where a=2 the terser APL expression is: a+a:2 (in
by 082349872349872 2y ago
Interpreting APL has a similar case: where a more verbose language would write something like:
a+a where a=2
the terser APL expression is:
a+a:2
(in which the left `a` is in scope of the right `a:`, which serves as both an lval for 2 and an rval for `a+`)
I don't know how APL did/does it, but when attempting to handle this syntax in a right-to-left operator evaluator I also wound up adding an ephemeral lvalue case.
(note also that C can be nearly as terse; it would express the above as:
(a=2,a+a)
assuming [unlike either of the above] that a has already been declared)