in lazy.rkt, fix bug in take, where (take 0 non-null-list) was not evaluating to null
This commit is contained in:
parent
8cbc701671
commit
39194ba5da
|
@ -585,7 +585,10 @@
|
|||
;; to its head, which can lead to memory leaks.
|
||||
(error 'take "index ~e too large for input list" n0)
|
||||
'())]
|
||||
[(pair? l) (cons (car l) (~ (loop (sub1 n) (! (cdr l)))))]
|
||||
[(pair? l)
|
||||
(if (zero? n)
|
||||
'()
|
||||
(cons (car l) (~ (loop (sub1 n) (! (cdr l))))))]
|
||||
[else (error 'take "not a proper list: ~e" l)]))
|
||||
(raise-type-error 'take "non-negative exact integer" 0 n l))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user