An array can have one element but it is not a scalar number. If it is an array it has not only magnitude but also direction.
A scalar number by definition scales - it has magnitude - it is not a vector or an array. It has rank 0. Donna [email protected] On 2010-10-25, at 9:19 PM, Roger Hui 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
