22 [1000000.0] [10e5] test
23 [1000000.0] [+10e5] test
24 [-1000000.0] [-10e5] test
25 [1050000.0] [10.5e5] test
26 [1050000.0] [+10.5e5] test
27 [-1050000.0] [-10.5e5] test
29 [(1,2,3)][(1,2,3)] test
30 ["Hello"] ["Hello"] test
32 [1] [{useregs} length] test
34 "Stack shuffling" print
37 [1 2 ] [1 2 3 8 2 pops] test
39 ["a""b""c""d""d"] ["a""b""c""d" 0 index] test
40 ["a""b""c""d""a"] ["a""b""c""d" 3 index] test
41 [0 2 3 1][0 1 2 3 3 -1 roll] test
42 [0 3 1 2][0 1 2 3 3 1 roll] test
43 [0 1 2 3][0 1 2 3 3 0 roll] test
44 [3 0 1 2][0 1 2 3 4 1 roll] test
45 [1 2 3 0][0 1 2 3 4 -1 roll] test
46 ["a" "b" "c" ["g"]] ["a" "b" "c" ["d" "e" "f" cleartomark "g"]] test
47 ["d" "e" "f" "g" 4] ["d" "e" "f" "g" counttomark] test
51 [[1 2 "X"]] [1 2 "X" 3 array] test
52 [-10] [[1 2 -10] 2 get] test
53 [-10] [[1 2 -10] -1 get] test
54 [[1 2 4]] [[1 2 -10] dup 2 4 put] test
55 [[1 "X" -10]] [[1 2 -10] dup -2 "X" put] test
56 [["a" "b" "c" "d"]] [["a" "b"] ["c" "d"] arrayappend] test
57 [["a" "b" 100]] [["a" "b"] 100 append] test
58 [{"a" "b" 100}] [{"a" "b"} 100 append] test
59 [["a" "b" "c"]] [["a" "b" "c" "d" "e"] 2 pop-back] test
60 [{"a" "b" "c"}] [{"a" "b" "c" "d" "e"} 2 pop-back] test
61 [["a" "b" "c" "d" "e"]] [["a" "b" "c" "d" "e"] 0 pop-back] test
62 [{"a" "b" "c" "d" "e"}] [{"a" "b" "c" "d" "e"} 0 pop-back] test
63 [["a" "b" "c" "d"]] [["a" "b" "c" "d" "e"] pop-back] test
64 [{"a" "b" "c" "d"}] [{"a" "b" "c" "d" "e"} pop-back] test
65 [["c" "d" "e"]] [["a" "b" "c" "d" "e"] 2 pop-front] test
66 [{"c" "d" "e"}] [{"a" "b" "c" "d" "e"} 2 pop-front] test
67 [["a" "b" "c" "d" "e"]] [["a" "b" "c" "d" "e"] 0 pop-front] test
68 [{"a" "b" "c" "d" "e"}] [{"a" "b" "c" "d" "e"} 0 pop-front] test
69 [["b" "c" "d" "e"]] [["a" "b" "c" "d" "e"] pop-front] test
70 [{"b" "c" "d" "e"}] [{"a" "b" "c" "d" "e"} pop-front] test
71 ["Boo" 1 2 3] ["Boo" [1 2 3] aload] test
72 [4] [["a" "b" "c" "d"] length] test
73 [[3 2 1 2 2]] [[1 2 3] [5 1 0 1 1] array-get] test
74 [[1 2 4 5 6]] [[1 2 3 4 5 6] 2 arrayremove] test
75 [[1 2 3 4 6]] [[1 2 3 4 5 6] -2 arrayremove] test
76 [[1 "hallo" 2 3 4]] [[1 ["hallo" 2] 3 [4] []] flatten] test
77 [[1 2 [3]]] [[1 [2 [3]]] flatten] test
78 [[16.2 33.5 49.0 64.3 80.5]] [[80.5 64.3 49.0 33.5 16.2] reverse] test
79 [[ 3 4 5 1 2 3 4 5 1 2 ]] [[ 1 2 3 4 5 ] -3 7 slice] test
80 [[ "c" "d" "e" ]] [[ "a" "b" "c" "d" "e" "f" "g" ] 3 2 subarray] test
84 [2 0 1] %P(ermutation)
90 sort-number-permutation
92 2 %index of the first element in p
93 get %get the first element of P
117 /squared {dup mul} def
118 [25] [5 squared] test
119 [{dup mul}] [/squared load] test
136 [1] [mydict /total known] test
137 [0] [mydict /badname known] test
142 /myBlack (0.0,0.0,0.0) def
144 [1] [currentdict /myBlack known] test
145 [0] [currentdict /myWhite known] test
155 [1 "OH HAI"] [/bing where exch /bong get] test
175 currentdict keys length
179 [/a 10 /b 20 /c 30] dictfromarray begin
186 [/a 10 /b 20 /c 30] exch dictfromarray begin
192 % Ensure original was mutated too!
202 dict dup /name exch def
213 ["Yes"] [1 {"Yes"} if] test
214 [] [0 {"Yes"} if] test
216 ["Yes"] [1 {"Yes"} {"No"} ifelse] test
217 ["No"] [0 {"Yes"} {"No"} ifelse] test
219 [1 2 4 8 16] [1 {dup 2 mul dup 16 ge {exit} if} loop] test
221 [["A" "A" "A" "A" "A" "A" "A" "A"]] [["A"] 3 {dup arrayappend} repeat] test
223 [2 6 10 14 18 22 26 30 34 38] [1 2 19 {2 mul} for] test
224 [2 6 10 14 18 22 26 30 34] [1 2 19 {2 mul} forx] test
226 [2 6 10 14] [1 2 7 {2 mul} for] test
227 [3 7 11 15] [[1 2 7 {2 mul} for] {1 add} forall] test
228 [[3 7 11 15]] [[1 2 7 {2 mul} for] {1 add} map] test
230 [ 10.1 9 8 7 6 5 4 3 2 ]
232 [ 1.1 2 3 4 5 6 7 8 9 ]
233 [ 9 7 5 3 1 -1 -3 -5 -7 ]
237 [ -7.9 -5 -2 1 4 7 10 13 16 ]
239 [ 1.1 2 3 4 5 6 7 8 9 ]
240 [ 9 7 5 3 1 -1 -3 -5 -7 ]
244 [[10.1 9 8 7 6 5 4 3 2]]
246 [ 1.1 2 3 4 5 6 7 8 9 ]
247 [ 9 7 5 3 1 -1 -3 -5 -7 ]
251 [/x] [/x /y 0 ifpop] test
252 [/y] [/x /y 1 ifpop] test
255 [2 1] [1 2 {usereg !b !a ;b ;a} exec] test
298 "Make sure nothing is left on the stack after the test" print
299 count [exch] [0] test