Talk:APL syntax and symbols/Archive 1
This is an archive of past discussions about APL syntax and symbols. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 |
Comment
APL symbols from unicode table: (Some many of these aren't in the article.)
⌶⌷⌸⌹⌺⌼⌽⌾⌿⍀⍁⍂⍃⍄⍅⍆⍈⍉⍊⍋⍌⍍⍎⍏⍐⍑⍒⍔⍕⍖⍗⍘⍙⍚⍛⍜⍝⍞⌻⍇⍓⍟⍠⍡⍢⍣⍤⍥⍦⍧⍨⍩⍪⍫⍬⍭⍮⍯⍰⍱⍲⍳⍴⍵⍶⍷⍸⍹⍺⎕
The other ones that aren't in the APL block but are APL symbols:
- ' apl quote; 0027
- ¯ apl overbar; 00AF
- ∘ apl jot; 2218
- ∣ apl stile; 2223
- ∼ apl tilde; 223C
- ⋆ star; 22C6
- ⌈ upstile; 2308
- ⌊ downstile; 230A
These are all according to Unicode 5. —porges(talk) 10:39, 15 August 2006 (UTC)
⍞ is "quote quad"; the print function [1] ⍡ = snout ⍢ = frog ⍣ = sourpuss ⍤ = hoot ⍥ = holler ⍨ = smirk/frown ⍝ = lamp (comment indicator) [2] —porges(talk) 06:39, 31 August 2006 (UTC)
"functions"
Can someone who knows APL go through and fix the nomenclature used in the article? I'm told "function" is not the right term. --Cybercobra (talk) 19:28, 13 August 2009 (UTC)
- I had a look at the raw text because it would be nice to get the operators in there as well, in their own table, bearing in mind that these tables are for the ISO 8485:1989 standard and don't include the ISO/IEC 13751:2001 enhancements. Perhaps another three table could be added for those.
- But then I saw the wiki syntax required to build tables! No doubt using the defaults is straightforward enough but ... Sorry, it's not for me. Phil Last (talk) 07:43, 14 August 2009 (UTC)
- Phil, pressing the button above the edit window will generate a table framework for you to use. Alternatively, HTML table syntax will also work (though not usually recommended, except in templates), so that might work if you already have some APL table-generating code. Just a thought. --NSH001 (talk) 08:26, 14 August 2009 (UTC)
- Had a go. There is a new intro, and a sketch the rules of syntax. I'd like to see the result retitled APL syntax and symbols. 5jt (talk) 13:17, 14 August 2009 (UTC)
- I have "moved" (renamed) the page as requested, as this is clearly a better title for the page. This should not necessarily be taken as the final name of the page; it can be moved again if a consensus for change emerges in discussion here. --NSH001 (talk) 15:38, 14 August 2009 (UTC)
Structure
Cybercobra has provoked me into writing sections on syntax. They could use revision by a grown up (Roger?) but I'm pleased that they display even to a reader unacquainted with APL the source of its brevity. The tables need revision and extension.
A simple and useful organisation might be into Functions, Operators and Miscellaneous. The last should include lamp/comment and diamond/separator.
The tables should distinguish the names of the glyphs from the functions and operators they denote. For example, the glyph ⍴ is called rho and denotes the monadic function shape and the dyadic function reshape.
Glyphs implemented by only some interpreters (eg ⍷ ⍣) should be so annotated, but should appear as Functions or Operators. Glyphs assigned to APL by the Unicode standard but nowhere in use should appear in Miscellaneous. 5jt (talk) 13:17, 14 August 2009 (UTC)
- Nice work Stephen Phil Last (talk) 11:21, 15 August 2009 (UTC)
Added new table "Operators"
I've only put in the original standard operators of reduction,scan and inner/outer products. Added Symbol column to distinguish (/) from (+/B) and labelled Meaning as (oif example) because I couldn't describe the definition of reduction in 6 words. Phil Last (talk) 22:16, 16 August 2009 (UTC)
Unicode codepoints
There should be an explanation regarding the choice of Unicode code points. Characters that were specifically added to Unicode to encode APL symbols are unquestionable, but other characters in tables seem to be chosen arbitrarily and with no relevance to what actual implementations and translation tables for legacy encodings use. Is there any official source regarding these? Does Unicode standard specify what to do with them? Characters for star, stile, tilde, and minus are questionable as usually different codes are used (i.e. the simplest ASCII equivalents: asterisk, pipe, tilde, and hyphen-minus, respectively). Additionally I'm certain that epsilon should be ∊ (U+220A), not ∈ (U+2208). — mwgamera (talk) 04:27, 9 May 2013 (UTC)
Dijkstra on APL
I've always felt that Dijkstra's condensed language observations [3] had to be treated with caution, since they're very much "throwaway comments" without reasoned argument. That's possibly most true of his observations on APL, since the language is mentioned minimally (if at all) in the corpus of the EWD essays (I admit that I lack the stamina to read every one in sequence).
I've also wondered what he was on when he wrote them, since they exude a bitterness that's remarkable even by his standards.
However, I've just come across something which lends context to Dijkstra's choice of words, specifically his "coding bums" epithet:
"[...]John McCarthy had once noticed how his graduate students who loitered around the 704 would work over their computer programs to get the most out of the fewest instructions, and get the program compressed so that fewer cards would need to be fed to the machine. Shaving off an instruction or two was almost an obsession with them. McCarthy compared these students to ski bums. They got the same kind of primal thrill from “maximizing code” as fanatic skiers got from swooshing frantically down a hill.
"So the practice of taking a computer program and trying to cut off instructions without affecting the outcome came to be called “program bumming,” and you would often hear people mumbling things like “Maybe I can bum a few instructions out and get the octal correction card loader down to three cards instead of four.”" [4]
There's no indication of how Dijkstra became aware of the terminology, I'm not aware of him spending time at MIT or collaborating with any of its alumni. MarkMLl (talk) 11:25, 25 November 2014 (UTC)
The Mathematical Shape of Things to Come
I propose deleting this link since nothing in it is relevant to APL per. se. MarkMLl (talk) 13:01, 7 June 2015 (UTC)
Minor Changes
I made some minor edits to the "Functions and Operators" section principally replacing instances of {{col-begin|...}} with tables as the former breaks incorrectly on certain displays. For example, when I first saw this section, the two lines
×/2 3 4 24
displayed as
×/2 3 4 24
because the width calculations in {{col-begin|...}} and {{col-break|...}} got in the way.
Also, I changed
- 0's and 1's to 0s and 1s as the reference is to a plural not a possessive.
- "left example" to "right example"
- inserted some spaces to improve readability
- etc. — Preceding unsigned comment added by Sudleyplace (talk • contribs) 20:26, 2 August 2015 (UTC)
Dyadic Left and Right functions
These are in ISO-13751 but not in APL2. Their monadic forms are not in ISO-13751 but allowed by some implementations, e.g. GNU APL. Franskraler (talk) 07:37, 14 December 2017 (UTC)
Missing symbols
At least one Unicode APL symbol is not addressed here [5]. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 20:39, 8 February 2016 (UTC)
- This and many others have already been listed as missing in 2006 by User:Porge (now User:Porges) in the section carelessly named just "#Comment" above. ◄ Sebastian 12:27, 25 February 2019 (UTC)
Example functions etc.
I've added a flow control section, with some example functions based very loosely on an IBM manual. I've put in placeholder text for "GOTO" operations, I need to hunt out more detail for that since one of the original manuals gives Iverson's rationale which is persuasive even for those who (like me) are of an ALGOL persuasion. Please don't jump on my last para until I've had more time to research this. MarkMLl (talk) 22:50, 19 September 2014 (UTC)
- Defined function and operators are either niladic, monadic, or ambivalent. Only Dyalog and NARS2000 make, as an extension, additional distinction between ambivalent and monadic in header. I couldn't find direct contradiction of your statement regarding a possibility of having same-named functions of different adicity, but I can't find either this being explicitly left for implementations to decide in ISO 13751. I think it's incorrect to say it's implementation defined, but feel free to prove me wrong if that was so specified somewhere, especially if it was before the ISO. In meantime, here's your ambivalent CURVEAREA function. — mwgamera (talk) 05:17, 20 September 2014 (UTC)
∇ AREA←DEGREES CURVEAREA RADIUS AREA←○RADIUS*2 →(0=⎕NC'DEGREES')/0 AREA←AREA×DEGREES÷360 ∇
Header line in Dyalog and NARS2000 should be:
∇ AREA←{DEGREES} CURVEAREA RADIUS … ∇
- Noted and grateful for your comments, but for the moment I'm sticking to the de-facto standard IBM syntax (Iverson, Berry et al.) which is also accepted by OpenAPL which I'm using to work through my examples and which has previously proven adequate for the bulk of Iverson's "Exposition" document. I've added more detail based on comments in Berry's "Primer" document although I still feel that there's something I've previously read which I can't locate, I've had to fudge the examples since I find that OpenAPL won't accept .jot .dot SEGMENTAREA etc., and there's no way right now that I'm putting time into APL\360.
- Anyway, I'm just about done and if I have been a bit free with syntax etc. I crave indulgence since I'm trying to capture the spirit if not the letter of the law. I'd like to cross-reference Collatz_conjecture#Iterating_on_real_or_complex_numbers since it deals with the same issue of converting a discrete choice into a continuous function, but there's one or two stages missing from their equations which I'm not trying to add since I've never attempted Wp maths markup. MarkMLl (talk) 22:42, 26 September 2014 (UTC)
- Sorry to add to such an old discussion, but I was poking around for a list of APL functions, and am a little confused about ∇: I think Dyalog APL does something different with it. Am I misunderstanding versions of APL? It might help to mention which versions/specifications of APL use such function headers. Some examples: https://dl.acm.org/doi/pdf/10.1145/3315454.3329960 doesn't use the function headers and https://tryapl.org/ lists ∇ as an operator for recursion.HugoGrant (talk) 20:52, 4 January 2021 (UTC)
Solving Puzzles : Pascal's Triangle example has errors.
I tried the example 'Pascal' one-liner in both GNU APL and Dyalog APL (18), both reject it. Since Dyalog APL extends the APL2 standard in many ways it would also be good to specify if examples on this page are for APL2 or the Dyalog variant.
The variable 'a' used within the {...} lambda seems incorrect, but I'm not good enough yet at APL to discover exactly what's wrong.
GNU APL --
Pascal←{0~¨⍨a⌽⊃⌽∊¨0,¨¨a∘!¨a←⌽⍳⍵} Pascal 4
VALENCE ERROR Pascal[1] λ←0∼¨⍨a⌽⊃⌽∈¨0,¨¨a∘!¨a←�
^ ^
Dyalog APL
--
Pascal←{0~¨⍨a⌽⊃⌽∊¨0,¨¨a∘!¨a←⌽⍳⍵} Pascal 4
RANK ERROR Pascal[0] Pascal←{0~¨⍨a⌽⊃⌽∊¨0,¨¨a∘!¨a←⌽⍳⍵}
∧
EDIT: After checking with the online stackexchange chat for APL, it was suggested that Dyalog will run the example if one first calls ⎕ML←3 to set compatibility level. A GNU APL compatible example would be desirable as well.
Russtopia (talk) 03:35, 5 March 2021 (UTC)
- I don't feel like editing it, but GNU APL will accept it if you replace
a∘!
with{a!⍵}
–MwGamera (talk) 14:42, 5 March 2021 (UTC)