Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!think.com!mips!darwin.sura.net!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Function evaluation in J
In-Reply-To: HAC041@DJUKFA11.BITNET's message of 24 Apr 92 15:41:30 GMT
Message-ID: <ROCKWELL.92Apr24214315@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <92115.154130HAC041@DJUKFA11.BITNET>
Date: Sat, 25 Apr 1992 02:43:15 GMT
Lines: 35

Konrad Hinsen:
   An example in Chapter 28 of An introduction to J" made me wonder
   what the precise rules for the evaluation of expressions actually
   are.

Take a look in the Dictionary, especially section 2E (on page 4 and
5 of the version 4 dicionary).

   Take
     c =. 1 2 3;4 5;6 7 8
   and enter
     (<@|.@>) c
   The result is c with the contents of each box reversed. However,
     <|.>c
   gives something completely different, namely
     +-----+
     |3 2 1|
     |5 4 0|
     |8 7 6|
     +-----+
   Until now I thought that function composition with @ simply
   executes one function after the other. The above example seems to
   prove the contrary.  So what is the rule governing function
   composition?

I believe you're thinking that @ is exactly the same as '@:', the
function derived by @ has the same rank as the verb on the right side
of the '@'.  When you evaluate a sequence of verbs, such as
   < |. > c
each one applies to the entire argument array -- in other words the
action of applying a verb to an array can be thought of as having
infinite rank.

-- 
Raul Deluth Miller-Rockwell                   <rockwell@socrates.umd.edu>
