composition of APL expressions 
Author Message
 composition of APL expressions

Before 1973 several APLs used left-to-right order of EVALUATION.  But so
far as I know every APL has always defined functions as right associative
with equal precedence (would anything else still be APL?)  

From your comments I believe it is the right associativity that causes you
the most problems.   This was adopted from conventional mathematical usage,
where the function name appears to the left of its arguments  f(x,y) and
compositions occur right to left  f(g(x)) == (fg)(x).  The primitive functions
are pretty well adapted to this syntax.  If you choose user-function names
carefully and arrange their arguments with an eye toward function usage
you can avoid most parenthetic messes.

Most line editors have a recall of the last line, on APLB we made ATTN
(aka BREAK) do that when it is the first keystroke of a new input.  So a
built-up expression might grow like:
      A+B
42                (hit ATTN at next prompt to see:)
      A+B
     ,R<-         (insertion editing comand)
      R<-A+B      (echoed for confirmation, you type RETURN)

Mathematica has an intriguing pair of built-in vectors IN[] and OUT[] which
are the history of inputs and outputs in this session (the names are read-only)
The last element of OUT[] is abbreviated as %% or something like that.  Now,
in Mathematica inputs and outputs are the same type (expression) so IN[17]
and OUT[17] are call-by-name and call-by-value versions of your 17th entry.

A lot of workstations, terminals and PCs have local editing features that
subsume all of the line-editing and input history.  I think the language
should stay clear of history substitutions (ala csh).  But I'd love to
preserve the output arrays in a nested vector somewhere, if only I could
convince enough users to devote the memory & disk space to doing this.

I always forget to say "R<-" before "BIG_EXPENSIVE_FUNCTION_CALL".  I guess
just preserving the last computed result would be enough for me.  APL2 has
something called Quad-R that might do this already... any IBMers know?




Sun, 17 Jan 1993 21:03:00 GMT  
 composition of APL expressions

Quote:

>I always forget to say "R<-" before "BIG_EXPENSIVE_FUNCTION_CALL".  I guess
>just preserving the last computed result would be enough for me.  APL2 has
>something called Quad-R that might do this already... any IBMers know?



Quad-R (and Quad-L) in APL2 contains right (and left) argument of the
current function in case of interrupt or error. This is very convenient
when debugging programs: it is possible to list the arguments and also
to respecify them and try to resume execution. So, the answer to your
question is no - Quad-R (and Quad-L) is set only when an error or
interrupt occurs in a primitive function, so it can't be used to
query the last computed result.

But it sure would be nice to be able to recall that last result!

__________________________________________________________________________


| Otakaari 1, 02150 Espoo, Finland              | voice: +358 0 451 4325 |



Wed, 17 Feb 1993 06:22:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. composition of APL expressions

2. regular expression matching in J ? (or APL)

3. apl and regular expressions

4. php like regular expressions in apl?

5. Support for regular expressions in APL?

6. I-APL, Vanguard APL, and APL.68000

7. Object Data Composition (following composition links), small Reverse-Engineering ?

8. PGF90-S-0087-Non-constant expression where constant expression required

9. PGF90-S-0087-Non-constant expression where constant expression required

10. Non-constant expression where constant expression required.

11. IF { EXPRESSION or EXPRESSION }

12. translate mathematics expressions to lisp expressions

 

 
Powered by phpBB® Forum Software