2017-11-18 14:54:53 -05:00
|
|
|
(load "../lang/functions.lisp")
|
|
|
|
|
|
|
|
(defun list-doubler (seed times-to-double)
|
|
|
|
(if (< times-to-double 1) seed
|
|
|
|
(recur (append seed seed) (- times-to-double 1))))
|
2017-11-18 18:01:00 -05:00
|
|
|
|
|
|
|
(defun decreasing-list (end size)
|
|
|
|
(decreasing-list-tail (list end) (+ end 1) size))
|
|
|
|
|
|
|
|
(defun decreasing-list-tail (seed end size)
|
|
|
|
(if (< size 1) seed
|
|
|
|
(recur (cons (+ (car seed) 1) seed) (+ end 1) (- size 1))))
|
|
|
|
|
|
|
|
(defun increasing-list (end size)
|
|
|
|
(increasing-list-tail (list end) (+ end 1) size))
|
|
|
|
|
|
|
|
(defun increasing-list-tail (seed end size)
|
|
|
|
(if (< size 1) seed
|
|
|
|
(recur (cons (- (car seed) 1) seed) (- end 1) (- size 1))))
|
2017-11-24 10:07:49 -05:00
|
|
|
|
|
|
|
(defun list-of (item size)
|
|
|
|
(list-of-tail nil item size))
|
|
|
|
|
|
|
|
(defun list-of-tail (seed item size)
|
|
|
|
(if (< size 1) seed
|
|
|
|
(recur (cons item seed) item (- size 1))))
|