20 lines
599 B
Common Lisp
20 lines
599 B
Common Lisp
(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))))
|
|
|
|
(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))))
|