nydp 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/nydp +1 -1
- data/lib/lisp/core-000.nydp +1 -0
- data/lib/lisp/core-010-precompile.nydp +15 -15
- data/lib/lisp/core-012-utils.nydp +6 -5
- data/lib/lisp/core-020-utils.nydp +20 -6
- data/lib/lisp/core-030-syntax.nydp +14 -16
- data/lib/lisp/core-035-flow-control.nydp +26 -8
- data/lib/lisp/core-040-utils.nydp +4 -15
- data/lib/lisp/core-041-string-utils.nydp +3 -3
- data/lib/lisp/core-043-list-utils.nydp +81 -16
- data/lib/lisp/core-045-dox-utils.nydp +2 -2
- data/lib/lisp/core-060-benchmarking.nydp +92 -27
- data/lib/lisp/tests/all-examples.nydp +20 -0
- data/lib/lisp/tests/any-examples.nydp +28 -0
- data/lib/lisp/tests/builtin-tests.nydp +3 -1
- data/lib/lisp/tests/collect-tests.nydp +10 -0
- data/lib/lisp/tests/curry-tests.nydp +7 -2
- data/lib/lisp/tests/error-tests.nydp +11 -0
- data/lib/lisp/tests/foundation-test.nydp +66 -0
- data/lib/lisp/tests/len-examples.nydp +1 -0
- data/lib/lisp/tests/list-gsub-examples.nydp +25 -0
- data/lib/lisp/tests/list-match-examples.nydp +40 -0
- data/lib/lisp/tests/list-tests.nydp +13 -0
- data/lib/lisp/tests/none-examples.nydp +16 -0
- data/lib/lisp/tests/parser-tests.nydp +4 -5
- data/lib/lisp/tests/quasiquote-examples.nydp +2 -0
- data/lib/lisp/tests/syntax-tests.nydp +3 -2
- data/lib/lisp/tests/tuples-examples.nydp +2 -2
- data/lib/nydp.rb +50 -18
- data/lib/nydp/assignment.rb +3 -1
- data/lib/nydp/builtin.rb +15 -13
- data/lib/nydp/builtin/error.rb +1 -1
- data/lib/nydp/builtin/handle_error.rb +8 -2
- data/lib/nydp/builtin/parse_in_string.rb +1 -1
- data/lib/nydp/builtin/plus.rb +4 -4
- data/lib/nydp/closure.rb +5 -1
- data/lib/nydp/compiler.rb +2 -3
- data/lib/nydp/cond.rb +134 -13
- data/lib/nydp/context_symbol.rb +4 -1
- data/lib/nydp/error.rb +8 -0
- data/lib/nydp/function_invocation.rb +46 -48
- data/lib/nydp/helper.rb +15 -0
- data/lib/nydp/interpreted_function.rb +10 -14
- data/lib/nydp/lexical_context.rb +13 -2
- data/lib/nydp/lexical_context_builder.rb +28 -13
- data/lib/nydp/pair.rb +35 -36
- data/lib/nydp/parser.rb +3 -0
- data/lib/nydp/runner.rb +4 -32
- data/lib/nydp/string_atom.rb +3 -2
- data/lib/nydp/symbol.rb +1 -1
- data/lib/nydp/symbol_lookup.rb +9 -1
- data/lib/nydp/truth.rb +1 -1
- data/lib/nydp/version.rb +1 -1
- data/lib/nydp/vm.rb +2 -2
- data/nydp.gemspec +1 -1
- data/spec/error_spec.rb +14 -4
- data/spec/hash_non_hash_behaviour_spec.rb +19 -12
- data/spec/hash_spec.rb +0 -13
- data/spec/pair_spec.rb +17 -3
- data/spec/spec_helper.rb +13 -1
- data/spec/symbol_spec.rb +1 -1
- metadata +9 -4
@@ -4,7 +4,7 @@
|
|
4
4
|
(inspect src))
|
5
5
|
|
6
6
|
(def dox-show-info (name what texts args src)
|
7
|
-
; show the given dox info
|
7
|
+
; show the given info.src dox info
|
8
8
|
; 'info arg is a dox object from the dox system
|
9
9
|
"~(if (eq? what 'mac) "Macro"
|
10
10
|
(eq? what 'def) "Function"
|
@@ -58,7 +58,7 @@ Examples for ~name
|
|
58
58
|
(if (no infos)
|
59
59
|
(p "No documentation for" ',name)
|
60
60
|
(each info infos
|
61
|
-
(p (dox-show-info info.name info.what info.texts info.args))))
|
61
|
+
(p (dox-show-info info.name info.what info.texts info.args info.src))))
|
62
62
|
(let examples (dox-examples ',name)
|
63
63
|
(if (no examples)
|
64
64
|
(p "No examples for" ',name)
|
@@ -1,9 +1,88 @@
|
|
1
|
+
(def bm-cond ()
|
2
|
+
(if (< 3 5) "less" "more"))
|
3
|
+
|
4
|
+
(def bm-cond-lex (var)
|
5
|
+
(if var "present" "absent"))
|
6
|
+
|
7
|
+
(def bm-cond-sym ()
|
8
|
+
(if bm-cond-sym-value "present" "absent"))
|
9
|
+
|
10
|
+
(def bm-cond-3 ()
|
11
|
+
(bm-cond-lex 1)
|
12
|
+
(bm-cond-lex nil))
|
13
|
+
|
14
|
+
(def bm-cond-4 ()
|
15
|
+
(assign bm-cond-sym-value 1)
|
16
|
+
(bm-cond-sym)
|
17
|
+
(assign bm-cond-sym-value nil)
|
18
|
+
(bm-cond-sym))
|
19
|
+
|
20
|
+
(def bm-cond-LEX-LEX-LIT (a b)
|
21
|
+
(if a b nil))
|
22
|
+
|
23
|
+
(def bm-cond-LEX-CND-LIT (a)
|
24
|
+
(if a (if (< a 3) "yes" "no") "other"))
|
25
|
+
|
26
|
+
(def bm-cond-6 ()
|
27
|
+
(if (< 3 5) (+ 3 5) (- 3 5)))
|
28
|
+
|
29
|
+
(def bm-cond-7 ()
|
30
|
+
(bm-cond-LEX-CND-LIT nil)
|
31
|
+
(bm-cond-LEX-CND-LIT 1)
|
32
|
+
(bm-cond-LEX-CND-LIT 5))
|
33
|
+
|
34
|
+
(def bm-cond-5 ()
|
35
|
+
(bm-cond-LEX-LEX-LIT 1 2)
|
36
|
+
(bm-cond-LEX-LEX-LIT nil 3))
|
37
|
+
|
38
|
+
(def bm-cond-OR (x)
|
39
|
+
(if x x "no"))
|
40
|
+
|
41
|
+
(def bm-cond-OR2 (x y z)
|
42
|
+
(if x x (if y y z)))
|
43
|
+
|
44
|
+
(def bm-cond-8 ()
|
45
|
+
(bm-cond-OR 1)
|
46
|
+
(bm-cond-OR nil))
|
47
|
+
|
48
|
+
(def bm-cond-OR-LEX-LEX (x y)
|
49
|
+
(if x x y))
|
50
|
+
|
51
|
+
(def bm-cond-9 ()
|
52
|
+
(bm-cond-OR-LEX-LEX 1)
|
53
|
+
(bm-cond-OR-LEX-LEX nil))
|
54
|
+
|
55
|
+
(def bm-cond-10 ()
|
56
|
+
(bm-cond-OR2 1 2 3)
|
57
|
+
(bm-cond-OR2 nil 2 3)
|
58
|
+
(bm-cond-OR2 nil nil 3)
|
59
|
+
(bm-cond-OR2 nil nil nil))
|
60
|
+
|
61
|
+
(def bm-cond-lex-lit-lit ()
|
62
|
+
(no nil)
|
63
|
+
(no 1))
|
64
|
+
|
65
|
+
(def bm-faster-do ()
|
66
|
+
(each x '(0 1 2 3 4 5 6 7 8 9) ;; each uses 'do internally
|
67
|
+
x))
|
1
68
|
|
2
69
|
(def bm-pythag ()
|
3
70
|
(for i 1 50
|
4
71
|
(for j 1 50
|
5
72
|
(sqrt (+ (* i i) (* j j))))))
|
6
73
|
|
74
|
+
(def bm-len-str ()
|
75
|
+
(len "abcd"))
|
76
|
+
|
77
|
+
(def bm-len-pair ()
|
78
|
+
(len '(a b c d)))
|
79
|
+
|
80
|
+
(def bm-len-hash ()
|
81
|
+
(len {a 1}))
|
82
|
+
|
83
|
+
(def bm-len-fn ()
|
84
|
+
(len list))
|
85
|
+
|
7
86
|
(def bm-repeat (f n)
|
8
87
|
(for b 1 n (f)))
|
9
88
|
|
@@ -102,31 +181,17 @@
|
|
102
181
|
|
103
182
|
(def rbs (name)
|
104
183
|
(let summary nil
|
105
|
-
;; (push (bm "
|
106
|
-
;; (push (bm "
|
107
|
-
;; (push (bm "
|
108
|
-
;; (push (bm "
|
109
|
-
;; (push (bm "
|
110
|
-
|
111
|
-
;; (push (bm "
|
112
|
-
;; (push (bm "
|
113
|
-
;; (push (bm "
|
114
|
-
;; (push (bm "
|
115
|
-
;; (push (bm "
|
116
|
-
;; (push (bm "
|
117
|
-
;; (push (bm "
|
118
|
-
;; (push (bm "1R arg lexical-vars " bm-1R-lc-call 10 50000) summary)
|
119
|
-
;; (push (bm "2R arg lexical-vars " bm-2R-lc-call 10 50000) summary)
|
120
|
-
;; (push (bm "3R arg lexical-vars " bm-3R-lc-call 10 50000) summary)
|
121
|
-
;; (push (bm "4R arg lexical-vars " bm-4R-lc-call 10 50000) summary)
|
122
|
-
;; (push (bm "0 arg lexical-vars " bm-0-lc-call 10 50000) summary)
|
123
|
-
;; (push (bm "1 arg lexical-vars " bm-1-lc-call 10 50000) summary)
|
124
|
-
;; (push (bm "2 arg lexical-vars " bm-2-lc-call 10 50000) summary)
|
125
|
-
;; (push (bm "3 arg lexical-vars " bm-3-lc-call 10 50000) summary)
|
126
|
-
;; (push (bm "4 arg lexical-vars " bm-4-lc-call 10 50000) summary)
|
127
|
-
;; (push (bm "hashing " bm-hash-fill 10 200000) summary)
|
128
|
-
;; (push (bm "pre-compile " bm-pre-compile-test 10 10000) summary)
|
129
|
-
;; (push (bm "LEX " bm-f-1-call 10 10000) summary)
|
130
|
-
;; (push (bm "LEX LEX " bm-f-2-call 10 10000) summary)
|
131
|
-
;; (push (bm "LEX LEX LEX " bm-f-3-call 10 10000) summary)
|
184
|
+
;; (push (bm "cond with OR " bm-cond-9 10 40000) summary)
|
185
|
+
;; (push (bm "cond with OR " bm-cond-9 10 100000) summary)
|
186
|
+
;; (push (bm "cond with OR " bm-cond-lex-lit-lit 10 100000) summary)
|
187
|
+
;; (push (bm "optimise DO forms " bm-faster-do 10 10000) summary)
|
188
|
+
;; (push (bm "length of string " bm-len-str 10 40000) summary)
|
189
|
+
(push (bm "length of pair " bm-len-pair 10 10000) summary)
|
190
|
+
;; (push (bm "length of hash " bm-len-hash 10 15000) summary)
|
191
|
+
;; (push (bm "length of uncountable " bm-len-fn 10 50000) summary)
|
192
|
+
;; (push (bm "cond " bm-cond-3 10 50000) summary)
|
193
|
+
;; (push (bm "cond " bm-cond-4 10 50000) summary)
|
194
|
+
;; (push (bm "cond " bm-cond-5 10 50000) summary)
|
195
|
+
;; (push (bm "cond " bm-cond-6 10 50000) summary)
|
196
|
+
;; (push (bm "cond " bm-cond-7 10 50000) summary)
|
132
197
|
(each s summary (p name " " s))))
|
@@ -0,0 +1,20 @@
|
|
1
|
+
(examples-for all?
|
2
|
+
("true when all items are numeric"
|
3
|
+
(all? num? '(1 2 3 4))
|
4
|
+
t)
|
5
|
+
|
6
|
+
("false when all items are not numeric"
|
7
|
+
(all? num? '(1 2 x 4))
|
8
|
+
nil)
|
9
|
+
|
10
|
+
("true for an atom"
|
11
|
+
(and (all? string? "really, all") t)
|
12
|
+
t)
|
13
|
+
|
14
|
+
("false for nil"
|
15
|
+
(all? x1 nil)
|
16
|
+
nil)
|
17
|
+
|
18
|
+
("false when any item is nil"
|
19
|
+
(and (all? x1 '(1 2 nil 4)) t)
|
20
|
+
nil))
|
@@ -0,0 +1,28 @@
|
|
1
|
+
(examples-for any?
|
2
|
+
("true when any item is non-nil"
|
3
|
+
(and (any? num? '(1 nil nil 4)) t)
|
4
|
+
t)
|
5
|
+
|
6
|
+
("true for an atom"
|
7
|
+
(and (any? string? "really, all") t)
|
8
|
+
t)
|
9
|
+
|
10
|
+
("false for an atom"
|
11
|
+
(any? num? "really, all")
|
12
|
+
nil)
|
13
|
+
|
14
|
+
("false for nil"
|
15
|
+
(any? x1 nil)
|
16
|
+
nil)
|
17
|
+
|
18
|
+
("false when all items are nil"
|
19
|
+
(any? sym? '(nil nil nil nil))
|
20
|
+
nil)
|
21
|
+
|
22
|
+
("true when at least one item is nil when looking for nil"
|
23
|
+
(any? no '(1 2 nil 4))
|
24
|
+
t)
|
25
|
+
|
26
|
+
("false when no item is nil when looking for nil"
|
27
|
+
(any? no '(1 2 3 4))
|
28
|
+
nil))
|
@@ -78,7 +78,9 @@
|
|
78
78
|
("multiplies 1 float" (* 4.2) 4.2)
|
79
79
|
("multiplies 2 floats" (* 4.2 0.5) 2.1)
|
80
80
|
("multiplies 3 floats" (* 4.2 -2.5) -10.5)
|
81
|
-
("multiplies 4 floats" (* 6.6 1.1 3.3) 23.958)
|
81
|
+
("multiplies 4 floats" (* 6.6 1.1 3.3) 23.958)
|
82
|
+
|
83
|
+
("multiplies a string" (* "foo" 3) "foofoofoo"))
|
82
84
|
|
83
85
|
(examples-for mod
|
84
86
|
("modulus for two ints" (mod 64 6) 4))
|
@@ -27,6 +27,16 @@
|
|
27
27
|
"zz")
|
28
28
|
nil))
|
29
29
|
|
30
|
+
(examples-for compact
|
31
|
+
("removes all nil items in list"
|
32
|
+
(compact (list 'a 'b nil 'c nil 'd nil nil))
|
33
|
+
(a b c d)))
|
34
|
+
|
35
|
+
(examples-for +0
|
36
|
+
("only adds non-nil items"
|
37
|
+
(+nz 1 2 nil 3 nil 4 nil nil)
|
38
|
+
10))
|
39
|
+
|
30
40
|
(examples-for reject
|
31
41
|
("returns all non-matching items in a list"
|
32
42
|
(reject (fn (x) (eq? (len x) 2))
|
@@ -2,7 +2,7 @@
|
|
2
2
|
(list a b c d e))
|
3
3
|
|
4
4
|
(examples-for curry
|
5
|
-
("zero-params"
|
5
|
+
("zero-params assumes nil initial parameter"
|
6
6
|
(let ck0 (curry chicken-korma)
|
7
7
|
(ck0 1 2 3 4 5))
|
8
8
|
(1 2 3 4 5))
|
@@ -12,12 +12,17 @@
|
|
12
12
|
(ck0 1 2 3 4))
|
13
13
|
(x 1 2 3 4))
|
14
14
|
|
15
|
+
("nestable"
|
16
|
+
(let ck0 (curry chicken-korma 'x)
|
17
|
+
((curry ck0 'y) 1 2 3))
|
18
|
+
(x y 1 2 3))
|
19
|
+
|
15
20
|
("two params"
|
16
21
|
(let ck0 (curry chicken-korma 'x 'y)
|
17
22
|
(ck0 1 2 3))
|
18
23
|
(x y 1 2 3))
|
19
24
|
|
20
|
-
("three params"
|
25
|
+
("three params ignores second and third params"
|
21
26
|
(let ck0 (curry chicken-korma 'x 'y 'z)
|
22
27
|
(ck0 1 2))
|
23
28
|
(x y z 1 2)))
|
@@ -14,6 +14,17 @@
|
|
14
14
|
x)
|
15
15
|
"impossible")
|
16
16
|
|
17
|
+
("handles nested errors"
|
18
|
+
(on-err (joinstr "\n" errors)
|
19
|
+
(on-err (error "foo")
|
20
|
+
(on-err (error "bar")
|
21
|
+
(on-err (error "toto")
|
22
|
+
(error "primum errorum")))))
|
23
|
+
"\"foo\"
|
24
|
+
\"bar\"
|
25
|
+
\"toto\"
|
26
|
+
\"primum errorum\"")
|
27
|
+
|
17
28
|
("handles errors but any ensuring clause gets called first"
|
18
29
|
(with (x nil y nil)
|
19
30
|
(on-err (= x 'impossible)
|
@@ -90,6 +90,72 @@
|
|
90
90
|
(if t "hello" "goodbye")
|
91
91
|
"hello")
|
92
92
|
|
93
|
+
("function condition"
|
94
|
+
(if (> 5 3) "hello" "goodbye")
|
95
|
+
"hello")
|
96
|
+
|
97
|
+
("function condition and outcome"
|
98
|
+
(if (> 5 3) (+ 5 3) (- 5 3))
|
99
|
+
8)
|
100
|
+
|
101
|
+
("global symbol : true"
|
102
|
+
(do (assign global-symbol-if-test 1)
|
103
|
+
(if global-symbol-if-test "yes" "no"))
|
104
|
+
"yes")
|
105
|
+
|
106
|
+
("global symbol : false"
|
107
|
+
(do (assign global-symbol-if-test nil)
|
108
|
+
(if global-symbol-if-test "yes" "no"))
|
109
|
+
"no")
|
110
|
+
|
111
|
+
("condition and when-true are the same ; literal when-false (true)"
|
112
|
+
(let x 1 (if x x "no"))
|
113
|
+
1)
|
114
|
+
|
115
|
+
("condition and when-true are the same ; literal when-false (false)"
|
116
|
+
(let x nil (if x x "no"))
|
117
|
+
"no")
|
118
|
+
|
119
|
+
("condition and when-true are the same ; cond when-false (true)"
|
120
|
+
(with (x 1 y 2) (if x x (if y y "else")))
|
121
|
+
1)
|
122
|
+
|
123
|
+
("condition and when-true are the same ; cond when-false (false/true)"
|
124
|
+
(with (x nil y 2) (if x x (if y y "else")))
|
125
|
+
2)
|
126
|
+
|
127
|
+
("condition and when-true are the same ; cond when-false (false/false)"
|
128
|
+
(with (x nil y nil) (if x x (if y y "else")))
|
129
|
+
"else")
|
130
|
+
|
131
|
+
("locally-bound condition: true"
|
132
|
+
(let x 1 (if x "yes" "no"))
|
133
|
+
"yes")
|
134
|
+
|
135
|
+
("locally-bound condition: false"
|
136
|
+
(let x nil (if x "yes" "no"))
|
137
|
+
"no")
|
138
|
+
|
139
|
+
("locally-bound cond and truth : true"
|
140
|
+
(with (x 1 y "yes") (if x y "no"))
|
141
|
+
"yes")
|
142
|
+
|
143
|
+
("locally-bound cond and truth : false"
|
144
|
+
(with (x nil y "yes") (if x y "no"))
|
145
|
+
"no")
|
146
|
+
|
147
|
+
("cond with locally-bound condition, conditional if true, literal when false : true/false"
|
148
|
+
(let x 1 (if x (if (> x 5) "wrong" "right") "otherwise"))
|
149
|
+
"right")
|
150
|
+
|
151
|
+
("cond with locally-bound condition, conditional if true, literal when false : true/true"
|
152
|
+
(let x 22 (if x (if (> x 5) "wrong" "right") "otherwise"))
|
153
|
+
"wrong")
|
154
|
+
|
155
|
+
("cond with locally-bound condition, conditional if true, literal when false : false"
|
156
|
+
(let x nil (if x (if (> x 5) "wrong" "right") "otherwise"))
|
157
|
+
"otherwise")
|
158
|
+
|
93
159
|
("nil is boolean false"
|
94
160
|
(if nil "hello" "goodbye")
|
95
161
|
"goodbye"))
|
@@ -0,0 +1,25 @@
|
|
1
|
+
(examples-for list-gsub
|
2
|
+
("it replaces a number in a nested list"
|
3
|
+
(list-gsub '(foo (1 2 3 42)
|
4
|
+
(bar (40 41 42 (nested 43 42 41))))
|
5
|
+
42
|
6
|
+
99)
|
7
|
+
(foo (1 2 3 99)
|
8
|
+
(bar (40 41 99 (nested 43 99 41)))))
|
9
|
+
|
10
|
+
("it replaces a sym in a nested list"
|
11
|
+
(list-gsub '(foo (1 2 3 42)
|
12
|
+
(foo (40 41 42 (foo 43 42 foo))))
|
13
|
+
'foo
|
14
|
+
'zzz)
|
15
|
+
(zzz (1 2 3 42)
|
16
|
+
(zzz (40 41 42 (zzz 43 42 zzz)))))
|
17
|
+
|
18
|
+
|
19
|
+
("it replaces a list in a nested list"
|
20
|
+
(list-gsub '(foo (1 (a b c) 3 42)
|
21
|
+
(foo (40 (a b c) 42 ((a b c) 43 42 foo))))
|
22
|
+
'(a b c)
|
23
|
+
'zzz)
|
24
|
+
(foo (1 zzz 3 42)
|
25
|
+
(foo (40 zzz 42 (zzz 43 42 foo))))))
|
@@ -0,0 +1,40 @@
|
|
1
|
+
(examples-for list-match?
|
2
|
+
("match the first element of a list"
|
3
|
+
(list-match? (list (curry eq? 'foo))
|
4
|
+
'(foo bar zorro))
|
5
|
+
t)
|
6
|
+
|
7
|
+
("the first element is a sym and the second element is a number: true"
|
8
|
+
(list-match? (list sym? num?)
|
9
|
+
'(foo 1 blah blah matches))
|
10
|
+
t)
|
11
|
+
|
12
|
+
("the first element is a sym and the second element is a number: wrong first element"
|
13
|
+
(list-match? (list sym? num?)
|
14
|
+
'("doesn't" 1 match at all))
|
15
|
+
nil)
|
16
|
+
|
17
|
+
("the first element is a sym and the second element is a number: wrong second element"
|
18
|
+
(list-match? (list sym? num?)
|
19
|
+
'(does not match at all))
|
20
|
+
nil)
|
21
|
+
|
22
|
+
("list has 3 elements: true"
|
23
|
+
(list-match? λx(eq? (len x) 3)
|
24
|
+
'(this does match))
|
25
|
+
t)
|
26
|
+
|
27
|
+
("list has 3 elements: false"
|
28
|
+
(list-match? λx(eq? (len x) 3)
|
29
|
+
'(this does not match))
|
30
|
+
nil)
|
31
|
+
|
32
|
+
("match improper list: true"
|
33
|
+
(list-match? (cons num? (cons sym? sym?))
|
34
|
+
'(10 green . bottles))
|
35
|
+
t)
|
36
|
+
|
37
|
+
("match improper list: false"
|
38
|
+
(list-match? (cons sym? (cons num? sym?))
|
39
|
+
'(this doesnt match))
|
40
|
+
nil))
|
@@ -1,3 +1,8 @@
|
|
1
|
+
(examples-for iso
|
2
|
+
("(nil) is not the same as nil"
|
3
|
+
(iso '(nil) nil)
|
4
|
+
nil))
|
5
|
+
|
1
6
|
(examples-for pair?
|
2
7
|
(" t for a cons" (pair? '(1 a 2 b 3 c)) t)
|
3
8
|
("nil for a number" (pair? 1) nil)
|
@@ -67,6 +72,10 @@
|
|
67
72
|
(nthcdr 3 '(a b c d e))
|
68
73
|
(d e))
|
69
74
|
|
75
|
+
("returns nothing for n = size of list"
|
76
|
+
(nthcdr 5 '(a b c d e))
|
77
|
+
nil)
|
78
|
+
|
70
79
|
("returns nothing for n > size of list"
|
71
80
|
(nthcdr 33 '(a b c d e))
|
72
81
|
nil))
|
@@ -129,6 +138,10 @@
|
|
129
138
|
(list-slices '(a b c d e) 12)
|
130
139
|
((a b c d e)))
|
131
140
|
|
141
|
+
("nothing but the list if the list is exactly the length of the page"
|
142
|
+
(list-slices '(a b c) 3)
|
143
|
+
((a b c)))
|
144
|
+
|
132
145
|
("exactly three lists"
|
133
146
|
(list-slices '(a b c d e f g h i) 3)
|
134
147
|
((a b c) (d e f) (g h i)))
|