Fix bug in take-at-most
This commit is contained in:
parent
836a7030e8
commit
20dba0c3d3
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
(define (take-at-most list n)
|
(define (take-at-most list n)
|
||||||
(let loop ((n n) (new-list '()) (list list))
|
(let loop ((n n) (new-list '()) (list list))
|
||||||
(if (< n 1) (reverse new-list)
|
(if (or (null? list) (< n 1)) (reverse new-list)
|
||||||
(loop (- n 1) (cons (car list) new-list) (cdr list)))))
|
(loop (- n 1) (cons (car list) new-list) (cdr list)))))
|
||||||
|
|
||||||
(define (disp . xs)
|
(define (disp . xs)
|
||||||
|
|
Loading…
Reference in New Issue