Hi Hudson, see below... /// Jürgen On 02/28/2019 11:59 PM, Hudson Flavio
Meneses Lacerda wrote:
There exist 2 left-overs from ancient APL 1 times:Hi Jürgen,=1= Syntatic-Sugar Symbols While trying ngn-apl, I noticed that it allows single-character non-ASCII/APL identifiers, something I considered potentially useful some time ago, when I wrote some operators as exercise using GNU APL. I used very short operator names (mostly one letter) so that the main function will not be eclipsed by the operator name. Simple symbols might look more suitable and expressive, specially if spaces are optional. It is not easy to figure out whether a name is a function (verb), a variable (noun) or an operator (adverb); more symbols allow for more conventions distinguishing names. That is not standard, of course. ł ← {(1↑⍵) ⍶ (1↓⍵)} ⍝ Fn ł A B ⇔ A Fn B (cut out first; move left) ׳ π, 1…10 Here is an example with a high sugar dose: N ← 200 ⍝ Number of samples t ← (0…N−1)÷N ⍝ Time f ← 7 ⍝ Frequency A ← sin π·t ⍝ Amplitude (sine window) ⎕PLOT A·cos 2·π·f·t In ngn-apl, one can have definitions like: ¿ ← {⍵×{«Math.random()»}¨⍵} ⍝ (random float between 0.0 and ⍵) π ← ○1 · ← × ¬ ← ∼ º ← {⌊⍵+.5} ⍝ round … ← [integer sequence with starting and ending values] cos ← {2○⍵} sin ← {1○⍵} atan ← {¯3○⍵} ∠ ← {180×(12○⍵)÷○1} ⍝ (angle in degrees from complex number) % ← {⍵÷100} √ ← {⍵*.5 ; ⍵*÷⍺} ⍝ (in ngn-apl, ';' separates monadic and diadic code) Σ ← +/ Π ← ×/ ✀ ← [split string at spaces or left argument] φ ← 0.5×1+(5*÷2) ⍝ phi - golden ratio constant ⇗ ← {⍵[⍋⍵]} ⍝ sort upwards ⇘ ← {⍵[⍒⍵]} ⍝ sort downwards ⅟ ← {÷⍵} ½ ← {⍵×.5} ∃ ← ∨/ ∀ ← ∧/ While some of the examples above are clearly superfluous (like Σ ¬ · replacing already easy-to-read +/ ∼ ×), other definitions can make the code more readable (e.g. ○ functions as sin, cos etc.): ⎕PLOT A·cos 2·π·f·t versus ⎕PLOT A×2○○2×f×t This '…' is very handy and intuitive: 35…40 ⇔ 35 36 37 38 39 40 35…30 ⇔ 35 34 33 32 31 30 The main issue may be how to input the symbols from the keyboard (easy within GNU Emacs + TeX Input Method, or using the "compose key"). a) ⍴⎕AV = 256, and b) every defined APL function contains only characters in ⎕AV (which is the essence of ⎕AV). The backgound of a) is that a character fits into a byte and this property is used by several transfer formats for APL data workspaces. In the old days there was no ⎕UCS and many APL programs used ⎕AV to programatically generate APL characters ro to write APL characters to bytes. As of today the ⎕AV of GNU APL is almost fully utilized and your proposal is impossible to implement without violating either a) or b) above. Another problem is, as you already mentioned, keyboards and, to some extent, displays. Keyboard not only means a mechanism to enter the new characters but also to find keycaps that show them. One of the things that I hated the most in old APL was the notorious character-backspace-character sequence used at that time. And the character ✀ in your example above does not display correctly in my email client and also not in my xterm (I could cut-and-paste it, though). For these reasons I believe that the amount of incompatibilities that your proposal would create is far bigger than its benefits. The )OFF proposal sounds reasonable, I will look into it.=2= EOF GNU APL might have some command-line option to --quit the program after running all the required scripts (without ')off'). Currently I use a bash script 'aplscript' that appends a file which only instruction is ')off'. Maybe also an option to load an alternative 'preferences' file (or to set individual options, like ^D tally to exit). Regarding an alternative preferences file, please note that a single preferences file can contain several profiles (selectable via command line option -p). Since this file is usually short, I find it more convenient to have one file with several profiles than several files, In particular when most options are the same in all files and only a few differ. Could you provide a reference? I never heard of Mr. or Mrs. Bergquist.=3= Optimization Questions That is just of curiosity: how do the 10 efficiency suggestions by Bergquist (p.34−37) apply to GNU APL? Actually the small numbers look quite ugly on the vertical axis when a length=4= Boxing Boxing might have an option to use raised numbers (¹²³…) to display lengths of axes. Normal-sized numbers are confusing in cases like this: ]boxing 21 ⊂ 3 5 ⍴ ⌽⍳15 ┌5─────────────┐ 315 14 13 12 11│ │10 9 8 7 6│ │ 5 4 3 2 1│ └──────────────┘ (¿315?) ┌⁵─────────────┐ ³15 14 13 12 11│ │10 9 8 7 6│ │ 5 4 3 2 1│ └──────────────┘ (Maybe that is too small…) Is there a boxing option with extra spaces? ┌5───────────────┐ 3 15 14 13 12 11 │ │ 10 9 8 7 6 │ │ 5 4 3 2 1 │ └────────────────┘ is 10 or more: ┌¹⁰─────────────────┐ ¹5 5 5 5 5 5 5 5 5 5│ ⁰5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ │5 5 5 5 5 5 5 5 5 5│ └───────────────────┘ An an extra space may look slightly better in case of numbers, but may confuse people when dealing with strings that often contain blanks. Right now the content of the frame is exactly what ⍕ produces, and that seems to me like a good property. And when it comes to aesthetics, I find the IBM style with → and ↓ more APL-like than the NARS style adapted in ]BOXING 21. Best, Hudson |
- [Bug-apl] miscellāneum Hudson Flavio Meneses Lacerda
- Re: [Bug-apl] miscellāneum Dr . Jürgen Sauermann
- Re: [Bug-apl] miscellāneum Hudson Flavio Meneses Lacerda
- Re: [Bug-apl] miscellāneum Dr . Jürgen Sauermann
- Re: [Bug-apl] miscellāneum Dr . Jürgen Sauermann
- Re: [Bug-apl] miscellāneum Hudson Flavio Meneses Lacerda
- Re: [Bug-apl] miscellāneum Dr . Jürgen Sauermann
- Re: [Bug-apl] miscellāneum Dr . Jürgen Sauermann
- Re: [Bug-apl] miscellāneum Hudson Flavio Meneses Lacerda
- Re: [Bug-apl] miscellāneum Dr . Jürgen Sauermann
- Re: [Bug-apl] miscellāneum Peter Teeson