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. |
|||||
SplitPoints2
If you have something like this:
1 2 3
and you want transform this into
1 0 1 0 0 1 0 0 0
than this is your phrase:
∊(IV+1)↑¨1
Examples
⎕FX ⍕2 1⍴'r←SplitPoints2 IV' 'r←∊(IV+1)↑¨1' ⍝ This will work in any APL dialect
SplitPoints2 3 1 2
1 0 0 0 1 0 1 0 0
SplitPoints2 2 9 11 5
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
Specialties
You might expect this expression:
(,1,[⎕IO+0.5]-,IV)/1
to be less expensive but at least in Dyalog it's the other way round: it's 31% faster. Besides, the expression does not work in NARSS2000 which does not accept negative arguments to /.
Compatibility
Checked with: Dyalog, NARS2000, APLX
Test Cases
Show test cases
Test my code, both Examples and Test Cases.
See also: SplitPoints1
Mentor: KaiJaeger
Tags:
APL Wiki