apl>" <-APL2-------------------- sam273.txt ---------------------------->
apl>" <- Relational Functions p218 ------------------------------------->
apl>)load cap2/help/help
cap2/help/help.apl
^ loaded.
entering e.g. help 'R' tells you what the R key does.
entering e.g. help 'reshape' tells you about the reshape function.
apl>'trial'='trial'
1 1 1 1 1
apl>8 -2 6 -4 0 < 0
0 1 0 1 0
apl>L#l#('in' 'out') (9 5 6) (`Z2 2RI4)
in out 9 5 6 1 2
3 4
apl>L#r#('it' 'but') 6 (2 2R1 8 5 4)
it but 6 1 8
5 4
apl>display l=r
+$------------------------------------------+
| +$--------------+ +$----+ +$------------+ |
| | +$--+ +$----+ | |0 0 1| U +$--+ +$--+ | |
| | |1 0| |0 1 1| | +~----+ | U1 0| U0 0| | |
| | +~--+ +~----+ | | |0 0| |0 0| | |
| +E--------------+ | +~--+ +~--+ | |
| | +$--+ +$--+ | |
| | U0 0| U0 0| | |
| | |0 0| |0 1| | |
| | +~--+ +~--+ | |
| +E------------+ |
+E------------------------------------------+
apl>" <- Replicate (/) ------------------------------------------------->
apl>1 2 3 4 / 'abcd'
abbcccdddd
apl>L#r#3 2R'a' 8 7 6 5 4
a 8
7 6
5 4
apl>2 -1 1 -2 / r
a a 8
7 7 0 6 0 0
5 5 0 4 0 0
apl>1 2 -1 3 -2 / 6 7 8
6 7 7 0 8 8 8 0 0
apl>0 2 0 1 / 'soap'
oop
apl>2 / 4 5
4 4 5 5
apl>L#s#,[I0]'ton'
t
o
n
apl>1 -2 2 / s
t tt
o oo
n nn
apl>1 -2 3 / 6
6 0 0 6 6 6
apl>L#w#'i' 'id' ('ide' 'idea')
i id ide idea
apl>`=w
3
apl>L#x#3 2 1 / w
iii id id ide idea
apl>`=x
3
apl>L#p#1 2 0 / w
i id id
apl>`=p
2
apl>" <- Replicate with Axis (/[] `/[]) -------------------------------->
apl>L#r#3 2 4RI24
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
apl>2 -1 1 / [2]r
1 2 3 4
1 2 3 4
0 0 0 0
5 6 7 8
9 10 11 12
9 10 11 12
0 0 0 0
13 14 15 16
17 18 19 20
17 18 19 20
0 0 0 0
21 22 23 24
apl>L#s#3 2 4 R I24
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
apl>2/[2]s
1 2 3 4
1 2 3 4
5 6 7 8
5 6 7 8
9 10 11 12
9 10 11 12
13 14 15 16
13 14 15 16
17 18 19 20
17 18 19 20
21 22 23 24
21 22 23 24
apl>L#t#3 1 4R'abcdefghijkl'
abcd
efgh
ijkl
apl>Rt
3 1 4
apl>-1 1/[2]t
abcd
efgh
ijkl
apl>R-1 1/[2]t
3 2 4
apl>L#m#3 4RI12
1 2 3 4
5 6 7 8
9 10 11 12
apl>1 0 2 -1 `/ m
1 2 3 4
9 10 11 12
9 10 11 12
0 0 0 0
apl>1 0 2 -1 /[1] m
1 2 3 4
9 10 11 12
9 10 11 12
0 0 0 0
apl>L#d#2 2 2R'he' 'me' 'we' 'us' 'i' 'a' 'o' 'e'
he me
we us
i a
o e
apl>Rd
2 2 2
apl>`=d
2
apl>L#j#0 2/[1]d
ia
oe
ia
oe
apl>`=j
1
apl>L#w#2 -1 1 /[2] d
he me
he me
we us
i a
i a
o e
apl>Rw
2 4 2
apl>`=w
2
apl>)off