PhraseBook: TechnicalReference
Contents
Phrases
Users of unicode enabled interpreters should be able to cut & paste the code from the phrase pages into their session or functions (but see Apl2Problems).
Others such as APL+WIN users can manually copy it.
Main Phrases
Phrases are single expressions with no statement separators ⋄ or newlines.
- Phrases should return the desired result rather than creating a side-effect on an existing array.
- Phrases should work on as many different platforms as possible.
Phrases should be ⎕IO=0 compatible (and preferably also ⎕IO=1) if possible and unless otherwise stated.
- Phrases should be ISO/IEC 13751 (Extended APL Standard) compatible if possible and unless otherwise stated.
- Phrases should be APL2 compatible if possible and unless otherwise stated.
Identifiers in phrases should follow the scheme in the NamingConventions table below or be assigned from them in a following comment: X...Y...Z ⍝ X←B0; Y←C1; Z←I2
Specialities
Incompatible phrases (as implied above and enumerated below) should be relegated to the Specialities section of the page keeping the head-line position for a compatible phrase.
Phrases within this section should be headed (level three) with the dialects which support them and annotated with the required system settings (⎕IO ⎕ML ⎕CT &c.).
Incompatibilities (to be avoided in main phrases)
⍬ (empty numeric vector) is not implemented in APL2 - use (⍳0) or '' when type is not critical.
Monadic ↓ - split is only implemented in Dyalog - use ⊂[0⊥⍳⍴⍴an]an enclose last axis.
First is ↑ and Mix is ⊃ in APL2 and compatibles.
First is ⊃ and Mix is ↑ in Dyalog with ⎕ML≤1.
Dyadic ⊂ - partition splits at negative greater-than difference in an integer mask with zero masking in APL2 and compatiblesas Partition; and splits at ones in a boolean mask with leading zero masking in Dyalog with ⎕ML<3. as Partitioned enclose.
⎕FX requires a character matrix in APL+WIN as opposed to that or a nested list elsewhere.
Neither '' nor (⍳0) is a valid argument to reshape of an empty array except in Dyalog.
⎕AI is not implemented in NARS2000.
Conforming Variants
- Alternative algorithms to the main phrase, perhaps with more annotated dependencies, that still conform to the constraints applied to main phrases, particularly in being interpreter independent.
- Reasons to include a variant:
- works for a larger domain;
- works along or across a different axis or dimension;
- works with a different rank;
- works at a different depth;
- is faster in particular circumstances;
- is capable of handling larger arrays.
NamingConventions
Naming Conventions |
|||||
|
Scalar |
Vector |
Matrix |
Any |
Non- |
Boolean |
BS |
BV |
BM |
BA |
BN |
Integer |
IS |
IV |
IM |
IA |
IN |
Float |
FS |
FV |
FM |
FA |
FN |
Numeric |
NS |
NV |
NM |
NA |
NN |
Character |
CS |
CV |
CM |
CA |
CN |
Enclosed |
ES |
EV |
EM |
EA |
EN |
enclosed |
TS |
TV |
TM |
TA |
TN |
Simple |
SS |
SV |
SM |
SA |
SN |
Any |
AS |
AV |
AM |
AA |
AN |
phrase e.g.: .X...Y. ⍝ X←BS; Y←IV |
|||||
combinations: use ISV for Integer scalar∨vector |
|||||
B3, I4 &c. to specify higher ranks. |
|||||
see GlossaryOfAplTerms for any of the above terms you don't understand.
APL Wiki