Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Is hook special
In-Reply-To: qmdbms@gsusgi2.gsu.edu's message of Thu, 14 May 1992 09:49:26 GMT
Message-ID: <ROCKWELL.92May14082927@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <qmdbms.705703600@gsusgi1.gsu.edu> <ROCKWELL.92May12192510@socrates.umd.edu>
	<qmdbms.705836966@gsusgi1.gsu.edu>
Date: Thu, 14 May 1992 13:29:27 GMT

Brian Schott
   Looking again at your suggestions and having gotten some help from Gene
   Mcdonnel (sp?, sorry), I am beginning to understand the situation a
   little better.

Gene's solution is better than mine, incidentally.

   I apparently couldn't even see the '@]' suffixed onto several verbs
   (e.g. i.@$@]   a@]#u@] ) !!! I am not quite clear yet,
             ^^    ^^  ^^
   though.

   I have had a difficult time imagining the need for this suffix; I
   thought it was a do-nothing addon, especially for a monadic verb.
   It appears to be preserving some needed rank consistency in the
   sequence of verbs, but I cannot see exactly why. Maybe someone can
   explain?

Maybe this little session will clear things up:
   !@]
+-+-+-+
|!|@|]|
+-+-+-+
   '! y.' : 11
+-+-+-+
|!|@|]|
+-+-+-+
   f =. '! y.' : 11
   f 3
6
   5 f 3
6
   5 ! 3
0

It's true that @] is something of a no-op in a monadic context, but in
a dyadic context it guarantees you'll get the right argument.

It's also true that the verb f@] has a rank of infinity, even if the
verb f does not.  But this was not particularly relevant for this
example.

   ... the prefix '#&1' is apparently a trick to preserve rank, also.
   In this case, does it force its input to become a vector, instead
   of a scalar, because the rank of "tally" '#' is (1 _)?

#&1 was just a way of conditionally generating an index (1).  I'm not
quite sure what your question means, but in the documentation on the
dyadic use of #, it says:
      '... if both are atoms they are treated as one-element lists'
which applies to this case.

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