Roger,

APL terminology has never been my strong point. You intimate that
"array" has always been a prominent part of APL exposition -- I have
nothing to reply to that. Because I've never heard of it is not to be
taken as casting any light on the matter. Perhaps I just wasn't paying
attention in class (I've never attended a class in APL)

It's quite likely I wasn't paying attention. I suppose my trouble is
that I've never taken formal specs seriously. As a mathematician -- a
one time logician -- you might imagine I should? Perhaps, like a
statistician's scorn for the way psychologists use statistics, I've
never been able to credit they knew what they were doing.

I've had a lot to do with language implementation projects in IBM. The
developers never paid any attention to formal specs: the languages
just grew. The code it was written in was formal enough for the
designer. There was only ever any interest in developing a formal
description (a) to help the documenters write teaching materials, (b)
to resolve problems uncovered by Product Test (they had this wonderful
tool called a Syntax Machines that generated random programs in your
language: a real stress-test for a compiler!) A formal description was
always a post-hoc exercise and had little or no influence on the
course of the project. We used to say IBM languages were
"implementation defined".

One that wasn't was the IBM Pascal compiler. Well, you know what
happened to that.

That was IBM. You may deplore the situation, but there were reasons
for it. I won't be drawn into defending them.

Outside IBM, things were different. Pascal, I'm told, was actually
published as a spec and only coded when Wirth was happy with it. I've
nothing but admiration for people able to carry that off. Hard to do
inside IBM, I'd have said. The salesmen could dump requirements on you
at any stage.

I won't be drawn into a debate about whether language implementation
*should* be driven by its formal spec. ADA was -- and that seemed to
be the heart of its problem. And APL... Well, you know far better than
I do.

So I've always been very interested in actual language-processor
behaviour, rather than formal specs published as documents. Given the
choice of publishing a formal spec as a written document, or a working
model, I've always supported the latter activity as more effective and
rewarding. Hence my involvement with the IAPL project -- which you
could describe as a delivery vehicle for the draft ISO spec.

I've also learned and used about 20 languages besides APL. With the
exception of DOS Batch Language they all had a notion of a "variable"
as a named repository for a number: a single bare number. Let me call
it a scalar, though few language manuals ever did. Most of them had
some concept of an array too. They rigorously distinguished, both in
syntax and implementation, between variables holding one numbers and
variables holding several numbers. If you were to tell an expert
programmer in one of these languages--smart men, all of them--that
there was a language called APL in which z←99 creates an array named
'z', he would laugh in your face.

And you ask me why it is counter-intuitive that a scalar is an array?

> In any case, you have not addressed the practical point
> I raised:  if a scalar is not an array, you are going to
> need a term for "array or scalar".  Another way to
> look at it is, why is it useful to distinguish between
> an array and a scalar?

I said I wasn't going to be drawn into a debate on the merits of one
language or another. I have no opinion on the matter. None that's fit
to repeat on this list. But you challenge me to give you an answer.
So...

'you are going to need a term for "array or scalar"...'
--- fine. How about "array or scalar"?

"why is it useful to distinguish between an array and a scalar?"
--- why should I care if it's useful? People do distinguish. That's
good enough for me.
Maybe the syntax of the language they use forces them to distinguish.
APL manuals I have read do seem to have made use of it. Is that
evidence enough that someone deems it useful?
How have they made use of it? By saying things like: if you want to
form (A+B) then A and B must be of the same shape -- or one of them
must be a scalar.
...I think my 6 year old granddaughter would be able to understand that.
What are her chances of following a formulation based on Rank?

Ian


On Tue, Oct 26, 2010 at 2:19 AM, Roger Hui <[email protected]> wrote:
> I had/have been an APLer for many years and I have
> never heard of scalars not being arrays.  As far as
> I know 99 is not just now deemed an array but
> have always been deemed an array.  I'd be interested
> in any APL reference you can find that says otherwise.
>
> A more ancient reference for that fact that a scalar is an array.
> Falkoff and Iverson, The APL\360 Terminal System, 1967-10-16.
> http://www.jsoftware.com/papers/APL360TerminalSystem.htm
>
> - A vector has a “rank” of one, the term being used,
> as in tensor analysis, to mean the number of indices
> required to identify a single element in an array.
> Hence, a scalar has rank zero and a matrix has rank two.
>
> - No special notational convention is required for the
> element-by-element extension, so that in the expression a+b ,
> for example, a and b may be any pair of matching arrays.
> If one argument is a scalar the other may be any array, ...
>
> ---
>
> In any case, you have not addressed the practical point
> I raised:  if a scalar is not an array, you are going to
> need a term for "array or scalar".  Another way to
> look at it is, why is it useful to distinguish between
> an array and a scalar?
>
> Whether a scalar is an array is not a statement that
> you can prove one way or the other, and you have to
> decide on considerations in the preceding paragraph,
> or considerations similar to same.
>
> Finally, why is it counter-intuitive that a scalar is
> an array?
>
>
>
> ----- Original Message -----
> From: Ian Clark <[email protected]>
> Date: Monday, October 25, 2010 17:44
> Subject: Re: [Jgeneral] "J In A Day" --crits please
> To: General forum <[email protected]>
>
>> Thanks, Roger, for the ref to the ISO standard: ISO 13751. Wow,
>> haven't things moved on since I was involved with the draft ISO
>> standard in 1992. I'd buy myself a copy, but they want $292 just
>> for a
>> lousy PDF. But yes: thanks for reminding me the Dyalog manuals are
>> free.
>>
>> No, I didn't really think you'd get it wrong. But I confess I'm amazed
>> that scalar 99 is now deemed an "array"! I thought I knew APL,
>> but I'd
>> never heard that one. (Yes, I knew about rank zero.)
>>
>> I'm now going to ask all my APL friends: "did you know 99 is an
>> array?" -- and see what they say.
>>
>> But you know what I think? I think it's counter-intuitive, and that's
>> the sort of thing that gets APL a bad name. And not just APL...
>>
>> I refuse to get into disputes about which is the better
>> language: APL
>> or J. What's more, "reductio" arguments don't work with me either,
>> unless I'm convinced we start from the same premises -- which
>> I'm not.
>>  I've spent my programming career porting code, and there
>> is no
>> "better" or "worse" language for me. There is just a source and a
>> target language. Which is which? Well, (1) who's paying? (2)
>> which way
>> does he want to migrate his code?
>>
>> I haven't touched APL for over a year now, but I've coded
>> heavily in
>> J. The reasons for that won't impress you. If you ask me which I have
>> any warm feeling for, I have to say APL... in the same way a doctor
>> prefers a sick patient to a healthy one. It's made me a living,
>> and a
>> good one.
>>
>> I've offered to write this crash-course for APLers. Some of them are
>> proud of their skill in the language -- and they don't respond
>> positively to having it dissed. I'm going to need to purge my answers
>> of all insinuation that APL is rubbish. People will be so relieved!
>> "It's about J and it doesn't rubbish APL...!"
>>
>> But I know what they're going to ask: what's with all these
>> nouns and pronouns?
>>
>> I've asked on this list: "what's a pronoun"? I still don't know the
>> answer (with my APL hat on, let me stress). I'm going to have to say:
>> "it's only metalanguage." (...right: where's it formally
>> defined?) "It
>> isn't. The documenters want you to read their minds." (...ok,
>> give me
>> a clue.) "I can't. In two year's time you'll think it's all perfectly
>> natural" (...meanwhile...?)
>>
>> Ian
>>
>>
>> On Mon, Oct 25, 2010 at 3:39 PM, Roger Hui <[email protected]> wrote:
>> > No, I don't mean "array or scalar", I meant "array".
>> > Let me cite two sources:
>> >
>> > 0. Dyalog APL Language Reference/Variables/Arrays: -
>> > A Dyalog APL data structure is called an array. ... An array
>> > may have 0 or more axes.
>> >
>> > 1. ISO/IEC 13751-2001, ISO Standard on Extended APL,
>> > Section 5.3.2: Scalar: An array whose rank is zero.
>> >
>> > As well, in practice, if a scalar in APL is if not an array,
>> > then when you talk about APL you'd be constantly saying
>> > "array or scalar" rather than just "array".   (I was
>> > once asked by non-mathematicians why 1 is not
>> > a prime.  After 5 seconds of thought I said,
>> > "because it makes lots of statements simpler".
>> > (As it is, you already have statements in math of the
>> > sort "let n be an odd prime".))
>> >
>> > In APL, if a "value" can only be an array, what word or
>> > words would you use when you need to say "the x of
>> > a phrase", when the phrase can be +/ or +/ 1 2 3
>> > or . or ¨?
>> >
>> > Reading your statements about "variable" in APL,
>> > with descriptions of quad-nc, artificial restrictions on
>> > reassignment, quad-ex, etc. etc.,   it strikes me that
>> > in contrast the meanings of "noun" and "pronoun"
>> > are simpler and more precise (less variable ...) than
>> > in APL. Even more so in any APLs which do not
>> > allow names be assigned to a function via ← .
>> > (Then functions can only be named as a side effect
>> > of ⎕fx or of an edit session.)  One more thing:
>> > Dyalog APL, which does allow sum←+/, does not
>> > allow each←¨ .  Explain that one.
>> >
>> >
>> >
>> > ----- Original Message -----
>> > From: Ian Clark <[email protected]>
>> > Date: Monday, October 25, 2010 0:38
>> > Subject: Re: [Jgeneral] "J In A Day" --crits please
>> > To: General forum <[email protected]>
>> >
>> >> Roger,
>> >>
>> >> I'd call sum a "variable" in APL if-and-only-if ([]NC 'sum')
>> >> returns 2.
>> >>
>> >> In Dyalog APL (I don't have it installed on my Mac) I seem to
>> recall>> you can indeed write:
>> >>       sum←+
>> >> but  []NC 'sum' would afterwards return 3, telling me it's
>> >> a function
>> >> (...whatever else it might have been before).
>> >>
>> >> So... "what do you call a name in APL whose referent is a
>> function?">> -- A function name.
>> >>
>> >> Moreover I think most APLs won't let you change "sum", say,
>> from a
>> >> variable name to a function name by reassigning it. Even if
>> functional>> assignment is permitted. The statement (sum←+)
>> causes an error
>> >> if sum
>> >> is already defined in the workspace as a variable, and you haven't
>> >> freed-up the name 'sum' for reuse by localisation or []EX.
>> >>
>> >> I use "value" (...but only in an APL context, let me
>> emphasise) to
>> >> mean "something that can be assigned to a variable" (...and
>> it still
>> >> remains a variable). I think a lot of APLers would agree with that.
>> >> It's a more restricted meaning of "value" than you imply in
>> the J
>> >> context, which it seems to me means anything acceptable to
>> the right
>> >> of a copula. Or, more precisely, any entity that is returned by
>> >> evaluating a phrase which can validly stand to the right of a
>> copula.>>
>> >> You say that "noun" in J corresponds directly and exactly
>> with "array"
>> >> in APL. Was that a mistake... don't you mean "array or scalar"?
>> >> (...commonly expressed as "vector or scalar" -- "array" not
>> >> being a
>> >> proper APL term, and [APL] "vector" not being restricted to 1-D
>> >> arrays.) Surely you don't mean me to infer that 99 is not a noun
>> >> in J
>> >> because it is not an "array" in APL?
>> >>
>> >> I'm not interested in challenging Ken's appeal to his implicit
>> >> understanding of English Grammar (which I deny is necessarily
>> >> mine, or
>> >> indeed anyone else's) to convey programming ideas. He's allowed
>> >> to do
>> >> that. I just want a precise enough notion of "noun/pronoun" --
>> >> as it
>> >> applies to J -- so I can point to something in J code and say with
>> >> confidence "that's a noun" or "that's a pronoun".
>> >>
>> >> Ian
>> >>
>> >>
>> >> 2010/10/25 Roger Hui <[email protected]>:
>> >> >> But Ken talks of "analogies", and seems to use the word "noun"
>> >> >> to mean a value or quantity: the result of an expression,
>> not the
>> >> >> variable -- or named memory location -- it's stored in. What,
>> >> in J,
>> >> >> corresponds to an APL "variable"?
>> >> >
>> >> > "Noun" in J does not mean value.  It corresponds
>> >> > directly and exactly to "array" in APL.  A value can
>> >> > be a verb (function), for example, "the value of the
>> >> > sentence +/ is a verb that does summation".
>> >> >
>> >> > Regarding your last question, It depends on how
>> >> > "variable" is used in APL.  If you say sum←+/ 2 3 4,
>> >> > I think you'd call "sum" a variable.  But if you say
>> >> > sum←+/, is "sum" still a variable?  If not, what is
>> >> > the difference, and what do you call a name in APL
>> >> > whose referent is a function?  If yes, doesn't it
>> >> > sound jarring to your ears?  (It does to mine.)
>> >> >
>> >> > And, a question Ken used to ask:  if sum←1 2 3,
>> >> > what is variable about "sum"?
>> >> >
>> >> > Some APL texts also calls .5 and 1 2 3 and 'abc'
>> >> > "variables, that is, used "variable" and "array"
>> >> > as synonyms.  Ken's question is even more pertinent
>> >> > in those cases:  If ever .5 has a different value
>> >> > ("varied"), I expect to get system errors shortly
>> >> > thereafter.
>> >> >
>> >> > There is a table in the dictionary section II. Grammar:
>> >> > http://www.jsoftware.com/help/dictionary/dict2.htm
>> >> >
>> >> > PARTS of SPEECH
>> >> >
>> >> > 50 fahrenheit           Nouns/Pronouns
>> >> > + - * % bump    Verbs/Proverbs
>> >> > / \     Adverbs
>> >> > &       Conjunction
>> >> > ( )     Punctuation
>> >> > =:      Copula
>> >> >
>> >> >
>> >> >
>> >> > ----- Original Message -----
>> >> > From: Ian Clark <[email protected]>
>> >> > Date: Sunday, October 24, 2010 12:21
>> >> > Subject: [Jgeneral] "J In A Day" --crits please
>> >> > To: General forum <[email protected]>
>> >> >
>> >> >> First draft of an article for eventual submission to VECTOR
>> >> entitled>> "J In A Day".
>> >> >>
>> >> >> http://www.jsoftware.com/jwiki/JinaDay
>> >> >>
>> >> >> It is "work-in-progress". It represents an "alpha" offering,
>> >> not a
>> >> >> "release" or "publication". It's aimed squarely at the
>> APLer who
>> >> >> doesn't know any J.
>> >> >>
>> >> >> There won't be many such on this list. But right now I'm keen
>> >> to get
>> >> >> the J right.
>> >> >>
>> >> >> The prevalent message to APLers coming to J is: un-learn
>> everything>> >> you know about APL (it's not helpful) and learn
>> J from first
>> >> >> principles. I think this erects an unnecessary barrier to the
>> >> >> dwindling(?) band of APLers ignorant of J.
>> >> >>
>> >> >> Of course the barriers may be there anyway. I recall my first
>> >> exposure>> to J aroused antipathy in me. I can't quite remember
>> >> why. A Kuhnian
>> >> >> paradigm-shift may be inescapable--or at least the need for
>> >> one. The
>> >> >> article deliberately avoids being starry-eyed so as not to
>> >> raise the
>> >> >> APLer's hackles. But this is not meant as provocation to the
>> >> J-er.
>> >> >>
>> >> >> There's a fairly defiant "admonition" (as MoinMoin calls it)
>> >> to J
>> >> >> experts -- but don't be put off. I would really appreciate your
>> >> >> comments. So get your anoraks on... ;)
>> >> >>
>> >> >> Of course, if an APL-er knowing absolutely no J were to work
>> >> through>> it, and confirm (or deny) it was of use to them...
>> >> that would
>> >> >> get me
>> >> >> on like 7-league boots.
>> >> >>
>> >> >> BTW I use the J terms "proverb" and "pronoun" in it. I
>> need to
>> >> >> know if
>> >> >> I'm using them correctly. See my separate posting.
>> >> >>
>> >> >> Thanks, Brian, for the Iverson ref. From the horse's mouth,
>> >> so to
>> >> >> speak. But Ken talks of "analogies", and seems to use the
>> >> word "noun"
>> >> >> to mean a value or quantity: the result of an expression,
>> not the
>> >> >> variable -- or named memory location -- it's stored in. What,
>> >> in J,
>> >> >> corresponds to an APL "variable"?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to