Newsgroups:   comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!jtsv16!itcyyz!yrloc!intern
From:         dgil@ipsaint.ipsa.reuter.COM (Gillett, David)
Subject:      Re: Expressiveness of Language
Message-ID: <1992Mar25.190531.8508@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:         25 Mar 92 19:00:07 UT


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


no. 6092322 filed 18.39.06  wed 25 mar 1992
from dgil
to   uclapl
subj Re: Expressiveness of Language
ref  6090162

     Pat Harrington wonders about setting the index origin to 1 in J.

     My question is:  why?  He says that he uses APL mainly for developing
stuff that he will rewrite in C, in which all indexing uses origin 0, and so
I wonder what he would gain from such a (mis?)feature.
     APL (versions that I have used) allows such a setting, and as a result
I've seen plenty of code that expends effort on origin-independence, or
localizes []IO 'just in case'.  I've seen collaborative code break in
mysterious ways because the team members had theological differences over this
issue.
     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.

     Pat also makes a passing mention of Pascal, which goes to the opposite
extreme of allowing the index origin to take many more values than zero and
one.  But in Pascal, there is not a single origin, but one for every array,
and there are no 'index' operations (such as APL's monadic iota) which are not
bound to some array.  This flexibility of index origin sticks out as something
of an anomaly in a language where most primitives are strictly scalar, and
arrays are something less than first-class entities.
     It's my experience that this origin-flexibility of Pascal's is rarely
used.  It's possible that programmers would find more use for it in a language
which was more array-oriented, but I think it's equally likely that the cases
where it is helpful are quite rare.  I certainly wouldn't want to try and graft
a wart like that onto APL or J on the off chance that somebody might find a use
for it....
                                      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.
