Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!geac!itcyyz!yrloc!hui
From: hui@yrloc.ipsa.reuter.COM (Roger Hui)
Subject: Re: Is hook really necessary?
Message-ID: <1991Jul6.132041.8745@yrloc.ipsa.reuter.COM>
Organization: Iverson Software Inc.
References: <ROCKWELL.91Jul3181219@socrates.umd.edu> <WEG.91Jul3194224@convx1.convx1.ccit.arizona.edu>
Date: Sat, 6 Jul 91 13:20:41 GMT

In article <WEG.91Jul3194224@convx1.convx1.ccit.arizona.edu> weg@convx1.ccit.arizona.edu (Eythan Weg) writes:

> I have often found that the two are related.  In fact, (I think about
> it as I am writing), the hook might be called right hook whose
> existence might be (?) a result of the way APL is parsed (right to
> left).  For I can write the following `left' hook in duality to the
> above fork definition of the hook:
>
>       f@] g [
>
> It does not exist because I think there is no way to write it in simple
> syntax as is used in the `right' hook.
 
When hook was defined (by Iverson & McDonnell), there was a choice:
   x (f g) y    is    x f g y          or
   x (f g) y    is    (f x) g y
I believe the decision in favor of the former is due to (+%)/ .
It's not a difficult decision because the "left hook" is simply   g~ f  .
 
> It seems to me that fork is the fundamental concept.  I do not yet
> know about typos and never will know about language design consequences.
 
Fork is fundamental.  One can show that an explicit sentence on
noun arguments x and y not involving x or y as arguments to operators,
can be written tacitly (without mention of x and y).  The proof
depends on fork.
 
> Since I am writing I wonder how one get f in
>    x f } y
> to specify the locations where items of x are to be inserted.  I mean
> something of a generic technique.  Often I find that I have to write y
> as an operand in the definition of f.
>
> Example:
>    y=. ? 2 3$100
> I want to replace any value in y less than 6 by 6.
>    y=. ($y)$  6 (6&>:,y) &# } ,y
> which is tasteless if not false.
>
> What troubles me here is:
> I do not like y to be part of f and I do not want to ravel y and if I
> do I want it to flex back to its original shape on its own (maybe via &.).
 
For this example, one could write:   y=.6>.y    (-:
Suppose p is a proposition (a boolean-valued verb).  x (p y)&(#&,)} y
replaces with x all cells of y where p y.  That y is often required 
as part of the operand is a weakness of } .

-----------------------------------------------------------------
Roger Hui
Iverson Software Inc., 33 Major Street, Toronto, Ontario  M5S 2K9
(416) 925 6096
