forked from lokedhs/gnu-apl-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgnu-apl-refdocs-apl2.el
More file actions
1090 lines (817 loc) · 28.9 KB
/
gnu-apl-refdocs-apl2.el
File metadata and controls
1090 lines (817 loc) · 28.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; -*- lexical-binding: t -*-
;;;
;;; Each element has the following structure:
;;;
;;; (SYMBOL
;;; ((TYPE NAME SUMMARY &optional DESCRIPTION)
;;; ...)
;;; IBM-COPYRIGHT-P)
;;;
;;; SYMBOL - A one-character string or list of alternatives, the actual symbol
;;; TYPE - The use-type, i.e. "Monadic", "Dyadic"...
;;; SUMMARY - Short one-line summary
;;; DESCRIPTION - Long description of the symbol
;;; IBM-COPYRIGHT-P - T if the text is an APL2 reprint
;;;
(defvar gnu-apl--symbol-doc
'(("+"
(("Monadic" "Conjugate" "Z is R with its imaginary part negated"
"Z←+R
R and Z: Numeric")
("Dyadic" "Add" "Adds R to L"
"Z←L+R
L, R and Z: Numeric"))
t)
;; ========================================
(("-" "−")
(("Monadic" "Negation" "Reverses the sign of R"
"Z←−R
R and Z: Numeric
")
("Dyadic" "Subtract" "Subtracts R from L"
"Z←L−R
L, R, and Z: Numeric"))
t)
;; ========================================
("×"
(("Monadic" "Signum" "¯1 if R<0; 0 if R=0; 1 if R>0"
"Z←×R
Yields the number of magnitude 1 with the same phase as R for
nonzero R. If R is 0, Z is 0.
R and Z: Numeric")
("Dyadic" "Multiply" "Multiplies L by R"
"Z←L×R
L, R, and Z: Numeric"))
t)
;; ========================================
("÷"
(("Monadic" "Reciprocal" "1 divided by R"
"Z←÷R
Divides 1 by R.
R and Z: Numeric, nonzero")
("Dyadic" "Divide" "Divides L by R"
"Z←L÷R
Divides L by R.
L, R, and Z: Numeric"))
t)
;; ========================================
("⋆"
(("Monadic" "Exponential" "e to the R power"
"Z←⋆R
Determines the Rth power of the base of the natural logarithms e,
where e is approximately 2.7182818284590452.
R and Z: Numeric")
("Dyadic" "Power" "L raised to the R power"
"Z←L⋆R
Raises base L to the Rth power.
Z, R and Z: Numeric"))
t)
;; ========================================
("○"
(("Monadic" "Pi times" "Multiply by π"
"Z←○R
Multiplies any number by π (approximately
3.1415926535897933).
R and Z: Numeric")
("Dyadic" "Circle functions" "Trigonometric functions of R selected by L"
"Z←L○R
L determines which of a family of circular, hyperbolic, Pythagorean,
and complex number functions to apply to R.
L: Integer such that ¯12≤L and L≤12
R and Z: Numeric
Functions:
L L○R L L○R
0 (1-R⋆2)⋆5
¯1 arcsin R 1 sin R
¯2 arccos R 2 cosin R
¯3 arctan R 3 tan R
¯4 (1+R⋆2)⋆5 4 (1+R⋆2)⋆5
¯5 arcsinh R 5 sinh R
¯6 arccosh R 6 cosh R
¯7 arctanh R 7 tanh R
¯8 -(8○R) 8 -(1-R⋆2)⋆0.5 for R≥0, (¯1-R⋆2)⋆0.5 for R<0
¯9 R 9 Real R
¯10 +R 10 |R
¯11 0J1 R 11 Imaginary R
¯12 ⋆0J1 R 12 Phase R"))
t)
;; ========================================
("?"
(("Monadic" "Roll" "Selects an integer at random from the population ⍳R"
"Z←?R
R: Positive integer
Z: Integer in the set ιR
Implicit arguments: ⎕IO and ⎕RL")
("Dyadic" "Deal" "Selects L integers at random from the population ⍳R without replacement"
"Z←L?R
L and R: Simple scalar or one-item vector, nonnegative integer
Z: Simple vector, integer in set ⍳R
Implicit arguments: ⎕IO and ⎕RL
⍴Z ←→ ,L
⍴⍴Z ←→ ,1"))
t)
;; ========================================
(("∊" "ε")
(("Monadic" "Enlist" "Creates a simple vector whose items are the simple scalars in R"
"Z←∊R
Z: Simple vector
⍴Z ←→ Number of simple scalars in R
⍴⍴Z ←→ ,1")
("Dyadic" "Member" "1 for elements of L present in R; 0 where not."
"Z←L∊R
Yields a Boolean array Z with the same shape as L. An item of Z is
1 if the corresponding item of L can be found anywhere in R. An
item of Z is 0 otherwise.
Z: Simple Boolean array
Implicit argument: ⎕CT
⍴Z ←→ ⍴L
⍴⍴Z ←→ ⍴⍴L"))
t)
;; ========================================
("⌈"
(("Monadic" "Ceiling" "Least integer greater than or equal to R"
"Z←⌈R
For real numbers, yields the smallest integer that is not
less than R (within the comparison tolerance).
For complex numbers, depends on the relationship of the real
and imaginary parts of R.
R and Z: Numeric
Implicit argument: ⎕CT")
("Dyadic" "Maximum" "The greater value of L or R"
"Z←L⌈R
Returns the larger of L and R.
L, R, and Z: Numeric, real"))
t)
;; ========================================
("⌊"
(("Monadic" "Floor" "Greatest integer less than or equal to R"
"Z←⌊R
For real numbers, yields the largest integer that does not exceed
R (within the comparison tolerance).
For complex numbers, depends on the relationship of the real and
imaginary parts of R.
R and Z: numeric
Implicit Argument: ⎕CT")
("Dyadic" "Minimum" "The smaller value of L or R"
"Z←L⌊R
Returns the smaller of L and R.
L, R and Z: Numeric, real"))
t)
;; ========================================
("⍴"
(("Monadic" "Shape" "Yields the size of each axis of R"
"Z←⍴R
Yields the size of each axis of R.
Z: Simple nonnegative integer vector.
⍴Z ←→ ⍴⍴R
⍴⍴Z ←→ ,1")
("Dyadic" "Reshape" "Structures the items of R into an array of shape L"
"Z←L⍴R
L: Simple scalar or vector, not negative integers.
⍴Z ←→ ,L
⍴⍴Z ←→ ⍴,L"))
t)
;; ========================================
("↑"
(("Monadic" "First" "Selects the first item of R taken in row major order"
"Z←↑R
Selects the first item of R taken in row major order. If R is empty,
yields the prototype of R.
⍴Z ←→ Depends on shape of the first item
⍴⍴Z ←→ Depends on rank of the first item")
("Dyadic" "Take" "Select the first or last L elements of R"
"Z←L↑R
Selects subarrays from the beginning or end of the
Ith axis of R, according to whether L[I]
is positive or negative.
L: Simple scalar or vector, integer
⍴Z ←→ ,L
⍴⍴Z ←→ ⍴,L")
("Dyadic with axis" "Take with axis" "Select the first or last L elements of R"
"Z←L↑[X]R
Selects subarrays from the beginning or end of
the X[I]th axis of R, according to whether
L[I] is positive or negative.
L: Simple scalar or vector, integer
R and Z: Nonscalar array
X: Simple scalar or vector; nonnegative integers: X∊⍳⍴⍴R; or empty
Implicit argument: ⎕IO
(⍴Z)[,X] ←→ ,L
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
("↓"
(("Dyadic" "Drop" "Remove the first or last L elements of R"
"Z←L↓R
Removes subarrays from the beginning or end of the Ith axis of R,
according to whether L[I] is positive or negative.
L: Simple scalar or vector, integer
Z: Nonscalar array
⍴Z ←→ 0 (⍴R)| L
⍴⍴Z ←→ (⍴,L) ⍴⍴R")
("Dyadic with axis" "Drop with axis" "Remove the first or last L elements of R"
"↓[] Drop with Axis
Z←L↓[X]R
Removes subarrays from the beginning or end of the X[I]th
axis of R, according to whether L[I] is positive or negative.
L: Simple scalar or vector, integer
R and Z: Nonscalar array
X: Simple scalar or vector; nonnegative integers: Xε⍳⍴⍴R; or empty
Implicit argument: ⎕IO
(⍴Z)[,X] ←→ 0 (⍴R)[,X]| L
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
(("|" "∣")
(("Monadic" "Magnitude" "Yields the distance between 0 and R"
"Z←|R
R: Numeric
Z: Numeric, real")
("Dyadic" "Modulo" "The remainder from dividing R by L"
"Z←L|R
For real positive L and R, the remainder from dividing R by L.
For all numbers, Z is R-L×⌊R÷L+L=0.
Note: ⌊ is computed with a comparison tolerance of zero.
L, R, and Z: Numeric
Implicit Argument: ⎕CT"))
t)
;; ========================================
(","
(("Monadic" "Ravel" "Creates a vector from the items in R, taken in row-major order"
"Z←,R
Z: Vector
⍴Z ←→ , /⍴R
⍴⍴Z ←→ ,1")
("Dyadic" "Catenate" "Elements of R appended to the elements of L"
"Z←L,R
Joins L and R. If L and R are nonscalar arrays, L and R are
joined along the last axis. If L and R are scalars, Z is a
two-item vector.
¯1↑⍴Z ←→ Case dependent
⍴⍴Z ←→ ,/(⍴⍴L),(⍴⍴R),1")
("Monadic with axis" "Ravel with axis" "Create an array of R reshaped according to X"
"Z←,[X]R
Creates an array that contains the items of R reshaped according
to axes X: If X is a fraction, a new axis of length 1 is formed;
if X is an integer, the X axes of R are combined.
X: Simple scalar fraction or simple scalar or vector of
nonnegative integers or empty
Implicit argument: ⎕IO
⍴Z ←→ Depends on the value of X
⍴⍴Z ←→ Depends on the value of X")
("Dyadic with axis" "Catenate with axis" "Join L and R along the axis indicated by X"
"Z←L,[X]R
Joins L and R along the axis indicated by X.
Z: Nonscalar
X: Simple scalar or one item vector, integer: X∊⍳(⍴⍴L) ⍴⍴R
Implicit argument: ⎕IO
⍴Z ←→ Case dependent
⍴⍴Z ←→ (⍴⍴L) ⍴⍴R")
("Dyadic with axis (fraction)" "Laminate" "Join L and R by forming a new axis of length 2"
"Z←L,[X]R
Joins L and R by forming a new axis of length 2, which is
filled with L and R.
Z: Nonscalar
X: Simple scalar fraction between ¯1+⎕IO and ⎕IO+(⍴⍴L) ⍴⍴R
Implicit argument: ⎕IO
⍴Z ←→ Case dependent
⍴⍴Z ←→ 1+(⍴⍴L)⌈⍴⍴R"))
)
;; ========================================
("\\"
(("Dyadic" "Expand" "Expands the last axis of R under the control of the Boolean vector LO"
"Z←LO\\R
Positions in Z that correspond to ones in LO are filled with
items of R. Positions in Z that correspond to 0's in LO are
filled with the fill item (↑0⍴⊂↑R).
LO: Simple Boolean scalar or vector
Z: Nonscalar array
¯1↓⍴Z ←→ 1↓⍴R
¯1↑⍴Z ←→ ⍴,LO
⍴⍴Z ←→ ⍴⍴R")
("Dyadic with axis" "Expand with axis" "Expands the Xth axis of R under the control of the Boolean
vector LO"
"Z←LO\\[X]R
Expand with axis is similar to expand, except that expansion
occurs along the Xth axis.
LO: Simple Boolean scalar or vector
R and Z: Nonscalar array
X: Simple scalar or one-item vector, integer: X∊⍳⍴⍴R
Implicit Argument: ⎕IO
(⍴Z)[,X] ←→ ⍴,LO
⍴⍴Z ←→ ⍴⍴R")
("Axis operator" "Scan" "The Ith item along the last axis is determined by the LO-reduction of I↑[⍴⍴R]R"
"Z←LO\\R
The Ith item along the last axis is determined by the
LO-reduction of I↑[⍴⍴R]R.
LO: Dyadic function
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
("⍀"
(("Axis with index" "Expand with axis" "Expands the Xth axis of R under the control of the Boolean
vector LO"
"Z←LO [X]R
LO: Simple Boolean scalar or vector
R and Z: Nonscalar array
X: Simple scalar or one-item vector, integer: X∊⍳⍴⍴R
Implicit Argument: ⎕IO
(⍴Z)[,X] ←→ ⍴,LO
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
("/"
(("Dyadic" "Replicate" "Repeats each subarray along the last axis under the control of the vector LO"
"Z←LO/R
Repeats each subarray along the last axis under the control of
the vector LO.
LO: Simple scalar or vector, integer
Z: Nonscalar array
¯1↓⍴Z ←→ ¯1↓⍴R
⍴⍴Z ←→ ⍴⍴R")
("Axis operator" "Reduce" "Evaluate R as if LO is placed between each element"
"Z←LO/R
Has the effect of placing the function LO between adjacent pairs of items along
the last axis of R and evaluating the resulting expression for each subarray.
LO: Dyadic function
⍴Z ←→ 1↓⍴R
⍴⍴Z ←→ 0⌈¯1+⍴⍴R"))
t)
;; ========================================
("⍳"
(("Monadic" "Interval" "Vector of the first R integers"
"Z←⍳R
Produces R consecutive ascending integers, beginning with ⎕IO.
R: Simple scalar or one-item vector, nonnegative integer
Z: Simple vector, nonnegative integers
Implicit argument: ⎕IO
⍴Z ←→ ,R
⍴⍴Z ←→ ,1")
("Dyadic" "Index of" "The location (index) of B in A; 1+⌈/⍳⍴A if not found"
"Z←L⍳R
Yields the first occurrence in L of items in R.
L: Vector
Z: Nonnegative integers
Implicit arguments: ⎕IO, ⎕CT
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
("⌹"
(("Monadic" "Matrix inverse" "Inverse of matrix B"
"Z←⌹R
Yields the inverse of a nonsingular matrix. Results for other
matrixes, vectors, and scalar R are discussed below.
R and Z: Simple numeric array of rank 2 or less
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R")
("Dyadic" "Matrix divide" "Yields the solution to system of linear equations"
"Z←L⌹R
Yields the solution of a system of linear equations or other algebraic
or geometric results, according to the values and shapes of L and R.
L and R: Simple numeric array of rank 2 or less
Z: Simple numeric
⍴Z ←→ (1↓⍴R),1↓⍴L
⍴⍴Z ←→ ,1¯2+(⍴⍴L)+⍴⍴R"))
t)
;; ========================================
("⌽"
(("Monadic" "Reverse" "Creates an array with the items of R reversed along the last axis"
"Z←⌽R
Creates an array with the items of R
reversed along the last axis.
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R")
("Monadic with axis" "Reverse with axis" "Creates an array with items reversed along the Xth axis"
"Z←⌽[X]R
X: Simple scalar or one-item vector, integer: X∊⍳⍴⍴R
Implicit argument: ⎕IO
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R")
("Dyadic" "Rotate" "The elements of R are rotated L positions"
"Z←L⌽R
Creates an array with items of R rotated
L positions along the last axis.
The sign of L determines the direction of
the rotation.
L: Simple integer, either scalar or rank ¯1+⍴⍴R
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R")
("Dyadic with axis" "Rotate with axis" "Creates an array with items of R rotated |L positions along the Xth axis"
"Z←L⌽[X]R
Creates an array with items of R rotated
|L positions along the Xth axis.
The sign of L determines the direction
of the rotation.
L: Simple integer, scalar, or vector
X: Simple scalar or one-item vector, integer: X∊ι⍴⍴R
Implicit argument: ⎕IO
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
("⊖"
(("Monadic" "Reverse" "Creates an array with the items of R reversed along the first axis."
"Z←⊖R
Creates an array with the items of R
reversed along the first axis.
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R")
("Monadic with axis" "Reverse with axis" "Creates an array with items reversed along the Xth axis"
"Z←⊖[X]R Creates an array with items reversed along the
Xth axis.
X: Simple scalar or one-item vector, integer: X∊ι⍴⍴R
Implicit argument: ⎕IO
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R")
("Dyadic" "Rotation" "The elements of R are rotated L positions along the first axis"
"Z←L⊖R
Creates an array with items of R rotated
L positions along the first axis.
The sign of L determines the direction of
the rotation.
⍴Z ←→ ⍴R
⍴⍴Z ←→ ⍴⍴R"))
t)
;; ========================================
("⍟"
(("Monadic" "Logarithm" "Natural logarithm of R"
"Z←⍟R
Determines the logarithm of R to the base of the natural logarithms
e, where e is approximately 2.7182818284590452.
R: Numeric, nonzero
Z: Numeric")
("Dyadic" "Logarithm" "Determines the base L logarithm of R"
"Z←L⍟R
Determines the base L logarithm of R.
L and R: Numeric, nonzero
Z: Numeric"))
t)
;; ========================================
("⍕"
(("Monadic" "Format" "A character representation of R"
"Z←⍕R
Creates a simple character array whose appearance is the same as
the display of R (if PW is set sufficiently wide.)
Z: Character array
Implicit argument: ⎕PP
⍴Z ←→ See APL2 Programming: Language Reference
⍴⍴Z ←→ ,1 ⍴⍴R if R is simple
⍴⍴Z ←→ ,1; or ,2 if R is nested")
("Dyadic" "Format by specification" "Format R into a character matrix according to L"
"Z←L⍕R
Transforms R to a character array that displays according to column
specifications L. Each pair of L corresponds to a column. The first
of the pair sets column width; the second sets display precision and
format – either conventional or scaled.
A single pair of integers extends the specification to all columns. A
single integer is interpreted as (0,L).
L: Simple integer vector
R: Array of depth 2 or less, whose items are simple
real scalars or simple character scalars or vectors
Z: Simple character array
Implicit argument: ⎕FC[1 4 6]
1↓⍴Z ←→ 1↓⍴R
⍴⍴Z ←→ 1 ⍴⍴R"))
t)
;; ========================================
("⍉"
(("Monadic" "Transpose" "Creates an array similar to R but with the order of the axes of R reversed"
"Z←⍉R
Creates an array similar to R but with the order
of the axes of R reversed.
⍴Z ←→ ⌽⍴R
⍴⍴Z ←→ ⍴⍴R")
("Dyadic" "Transpose" "The axes of R are ordered by R"
"Z←L⍉R
Case 1: L selects all axes of R. Creates an
array similar to R but with the axes permuted
according to L.
Case 2: L includes repetitions of axes. Creates
an array with two or more axes of R mapped
into a single axis of Z, which is then a diagonal
cross section of R.
L: Simple scalar or vector, nonnegative integer
Implicit Argument: ⎕IO
Case 1
⍴Z ←→ (⍴R)[⍋L]
⍴⍴Z ←→ ⍴⍴R
Case 2
I⊃⍴Z ←→ ⌊/(L=I)/⍴R
(for each I∊⍳⍴⍴Z)
⍴⍴Z ←→ ,+/(LιL)=⍳⍴L"))
t)
;; ========================================
("!"
(("Monadic" "Factorial" "Product of integers 1 to R"
"Z←!R
For positive integer R, yields the product of all positive integers
through R.
For all numbers but negative integers, factorial yields the Gamma
function of R+1.
R: Numeric, except for negative integers
Z: Numeric
Gamma Function: Factorial approximates the gamma function of (n+1).")
("Dyadic" "Binomial" "For nonnegative integer arguments, yields the number of distinct combinations of R things taken L at a time"
"Z←L!R
For nonnegative integer arguments, yields the number of distinct
combinations of R things taken L at a time.
In the following table, <0 means that L, R, or R−L is a negative integer and
≥0 means that L, R, or R−L is a nonnegative integer. The corresponding
definition is used.
Case Definition
L R R|L
≮0 ≮0 ≮0 Return (!R)÷(!L)×!R−L
≮0 ≮0 <0 Return 0
≮0 <0 ≮0 (Case cannot occur.)
≮0 <0 <0 Return (¯1*L)×L!L−R+1
<0 ≮0 ≮0 Return 0
<0 ≮0 <0 (Case cannot occur.)
<0 <0 ≮0 Return (¯1*R−L) (−R+1)!(| L+1)
<0 <0 <0 Return 0"))
t)
;; ========================================
("<"
(("Dyadic" "Less than" "Comparison: 1 if true, 0 if false"
"Z←L<R
Less than
L and R Numeric real
Z: Boolean
Implicit Argument: ⎕CT"))
t)
;; ========================================
("≤"
(("Dyadic" "Less than or equal" "Comparison: 1 if true, 0 if false"
"Z←L≤R
Less than or equal
L and R Numeric real
Z: Boolean
Implicit Argument: ⎕CT"))
t)
;; ========================================
("="
(("Dyadic" "Equality" "Comparison: 1 if true, 0 if false"
"Z←L=R
Equal
Z: Boolean
Implicit Argument: ⎕CT"))
t)
;; ========================================
("≥"
(("Dyadic" "Greater than or equal" "Comparison: 1 if true, 0 if false"
"Z←L≥R
Greater than or equal
L and R Numeric real
Z: Boolean
Implicit Argument: ⎕CT"))
t)
;; ========================================
(">"
(("Dyadic" "Greater than" "Comparison: 1 if true, 0 if false"
"Z←L>R
Greater than
L and R Numeric real
Z: Boolean
Implicit Argument: ⎕CT"))
t)
;; ========================================
("≠"
(("Dyadic" "Not equal" "Comparison: 1 if true, 0 if false"
"Z←L≠R
Not equal
Z: Boolean
Implicit Argument: ⎕CT"))
t)
;; ========================================
("∨"
(("Dyadic" "Or" "Logic: 0 if A and B are 0; 1 otherwise"
"Z←L∨R
Or
L, R, and Z: Boolean"))
t)
;; ========================================
(("∧" "^")
(("Dyadic" "And" "Logic: 1 if A and B are 1; 0 otherwise"
"Z←L∧R
And
L, R, and Z: Boolean"))
t)
;; ========================================
("⍱"
(("Dyadic" "Nor" "Logic: 1 if both A and B are 0; otherwise 0"
"Z←L⍱R
Nor
L, R, and Z: Boolean"))
t)
;; ========================================
("⍲"
(("Dyadic" "Nand" "Logic: 0 if both A and B are 1; otherwise 1"
"Z←L⍲R
Nand
L, R, and Z: Boolean"))
t)
;; ========================================
("⍋"
(("Monadic" "Grade up" "Indices of R which will arrange R in ascending order"
"Z←⍋R
Yields a vector of integers (a permutation of ⍳1↑⍴R) that puts the
subarrays along the first axis of R in ascending order.
R: Simple nonscalar numeric array
Z: Simple vector nonnegative integers
Implicit argument: ⎕IO
⍴Z ←→ 1↑⍴R
⍴⍴Z ←→ ,1")
("Grade up" "Indices or R which will arrange R in ascending order based on collating sequence specified as L"
"Z←L⍋R
Yields a vector of integers (a permutation of ⍳1↑⍴R) that puts the
subarrays along the first axis of R in ascending order according to
the collating sequence L.
L: Simple nonempty nonscalar character array
R: Simple nonscalar character array
Z: Simple vector, nonnegative integers
Implicit argument: ⎕IO
⍴Z ←→ 1↑⍴R
⍴⍴Z ←→ ,1"))
t)
;; ========================================
("⍒"
(("Monadic" "Grade down" "Indices of R which will arrange R in descending order"
"Z←⍒R
Yields a vector of integers (a permutation of ⍳1↑⍴R) that puts the
subarrays along the first axis of R in decending order.
R: Simple nonscalar numeric array
Z: Simple vector nonnegative integers
Implicit argument: ⎕IO
⍴Z ←→ 1↑⍴R
⍴⍴Z ←→ ,1")
("Dyadic" "Grade down" "Indices or R which will arrange R in descending order based on collating sequence specified as L"
"Z←L⍒R
Yields a vector of integers (a permutation of ⍳1↑⍴R) that puts the
subarrays along the first axis of R in descending order according to
the collating sequence L.
L: Simple nonempty nonscalar character array
R: Simple nonscalar character array
Z: Simple vector, nonnegative integers
Implicit argument: ⎕IO
⍴Z ←→ 1↑⍴R
⍴⍴Z ←→ ,1"))
t)
;; ========================================
("⍎"
(("Monadic" "Execute" "Evaluates the statement represented by the character vector R"
"Z←⍎R
Evaluates the statement represented by the character vector R.
R: Simple character scalar or vector
⍴Z ←→ Data dependent
⍴⍴Z ←→ Data dependent"))
t)
;; ========================================
("←"
(("Dyadic" "Assignment" "Specification or assignment arrow"
"←
Associates a name with an array, or modifies the values of selected posi-
tions in an array already associated with a name."))
t)
;; ========================================
("→"
(("Monadic" "Goto" "Branch or escape arrow"
"→
Followed by an expression, indicates the next line, if any, in a
defined function or operator to be executed. Alone, clears the
state indicator of a suspended operation and its entire calling
sequence."))
t)
;; ========================================
("∇"
(("Monadic" "Function definition" "Define or modify a function")))
;; ========================================
("⊂"
(("Monadic" "Enclose" "Creates a scalar array whose only item is R"
"Z←⊂R
Creates a scalar array whose only item is R.
Z: Scalar array
⍴Z ←→ ⍳0
⍴⍴Z ←→ ,0")
("Monadic with axis" "Enclose with Axis" "Yields an array across the set of axes indicated by X"
"Z←⊂[X]R
Yields an array whose items are the contiguous subarrays along
the set of axes indicated by X. That is, the set of axes indicated
by X is enclosed.
X: Simple scalar or vector, nonnegative integer.
If X is nonempty, X∊⍳⍴⍴R.
Implicit argument: ⎕IO
⍴Z ←→ (⍴R)[(⍳⍴⍴R)~X]
⍴↑Z ←→ (⍴R)[,X]
⍴⍴Z ←→ (⍴⍴R)-⍴,X")
("Dyadic" "Partition" "Partitions R into an array of vectors specified by L"
"Z←L≡R
Partitions R into an array of vectors specified by L.
L: Simple scalar or vector of nonnegative integers
R: Nonscalar
Z: Array of vectors
⍴Z ←→ (¯1↓⍴R),+/2</0,L (after left scalar extended)
⍴⍴Z ←→ ⍴⍴R
≡Z ←→ 1+≡R")
("Dyadic with axis" "Partition with axis" "Partitions R into an array of vectors specified by L along axis X"
"Z←L⊂[X]R
Partitions R into an array of vectors specified by L along axis
X.
L: Simple scalar or vector of nonnegative integers
R: Nonscalar
Z: Array of vectors
X: Simple scalar or one-item vector;
nonnegative integer: X∊⍳⍴⍴R
Implicit argument: ⎕IO
X⊃⍴Z ←→ +/2</0,L
⍴⍴Z ←→ ⍴⍴R
≡Z ←→ 1+≡R"))
t)
;; ========================================
("⊃"
(("Monadic" "Disclose" "Structures the items of R into an array, whose rightmost axes come from the axes of the items of R"
"Z←⊃R
Structures the items of R into an array, whose rightmost axes come
from the axes of the items of R.
(⍴Z) ←→ (⍴R),↑⌈/(⍴¨̈(,R),⊂↑R)~⊂⍳0
(⍴⍴Z) ←→ (⍴⍴R)+↑⌈/⍴¨̈⍴¨̈(,R),⊂↑R")
("Monadic with axis" "Disclose with axis" "Structures the items of R into an array. X defines the axes of Z, into which items of R are structured"
"Z←⊃[X]R
Structures the items of R into an array. X defines the axes of Z,
into which items of R are structured.
X: Simple scalar or vector, nonnegative integers
Implicit argument: ⎕IO
(⍴Z)[,X] ←→ ↑⌈/(⍴¨̈(,R),⊂↑R)~⊂ι0
⍴⍴Z ←→ (⍴⍴R)+⌈/∊⍴¨̈⍴¨̈(,R),⊂↑R")
("Dyadic" "Pick" "Selects an item of R as specified by the path indexes L"
"Z←L⊃R
Selects an item of R as specified by the path indexes L.
L: Scalar or vector whose depth is ≤2; integer or empty
Implicit argument: ⎕IO