Newsgroups:   comp.lang.apl
Path: watmath!watserv1!utgpu!cs.utexas.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!uunet.ca!geac!itcyyz!yrloc!intern
From:         dgil@ipsaint.ipsa.reuter.COM (Gillett, David)
Subject:      Re: Expressiveness of Language
Message-ID: <1992Mar30.212149.15679@yrloc.ipsa.reuter.COM>
Sender: intern@yrloc.ipsa.reuter.COM (Intern via QUADRAM)
Reply-To:     dgil@ipsaint.ipsa.reuter.COM (Gillett, David)
Organization: Reuters Information Services (Canada)
Date:         30 Mar 92 21:00:07 UT
Lines: 49


-----------Message forwarded from IPSA Mailbox-------------


no. 6105710 filed 20.30.40  mon 30 mar 1992
from dgil
to   uclapl
subj Re: Expressiveness of Language
ref  6103682

I wrote:
>     There is a discontinuity in APL between the units used by take/drop,
>which do not depend on the origin, and the units used by indexing, which does.
>J's scheme unifies these, resulting in merge/select semantics which are both
>simpler, in that they are more unified, and more powerful, in that they are
>more general.  A fixed index origin of zero seems, to me, a small price to
>pay.

To which Bill Chang replied:
>Could you describe merge/select for those of us who don't yet know J?  Thanks.

     Not very well; certainly not as well as several of the others who post
here....
     But I can at least explain what I mean.  In APL, x[1] is sometimes the
first element and sometimes the second, depending on []IO, but 1 ^ x is
*always* the first element.  That's the discontinuity:  the numbers used to
refer to part of an array have different semantics.
     In J, index 0 is always the first element.  Indices 1, 2, 3, etc. have the
obvious semantics of origin-0 indexing, and indices -1, -2, -3 have the
take/drop-like semantics of 'wrapping around' to the end of the array.  A
given index *always* refers to a specific position in the array, and (for some
n) all integers from -n...0...+n map to specific positions in the array.  (I'm
not sure whether J allows this interval to cover the entire span of integers,
wrapping as necessary (which has a certain mathematical appeal), or whether n
is the size of the array (which would probably catch a certain number of
programming errors).)
     Allowing origin variation breaks the 'constant reference' property of
indices.  Allowing origin 1 breaks the 'contiguous interval of integers'
property, by making index 0 anomalous.  It is these semantics of the indices,
rather than the syntax/semantics of merge/select, to which I was referring.

                                       Dave Gillett


-----------------------------------------------------------
This posting is forwarded from an internal Reuters mailbox.
No statement or opinion contained herein should be taken as
being Reuters policy, or even as being approved by Reuters,
in any way.
