Fix bug in take-at-most

This commit is contained in:
Lassi Kortela 2021-08-21 17:22:41 +03:00
parent 836a7030e8
commit 20dba0c3d3
1 changed files with 1 additions and 1 deletions

View File

@ -42,7 +42,7 @@
(define (take-at-most list n)
(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)))))
(define (disp . xs)