transcendental-lisp/lisp/tail/length-recursion.lisp

12 lines
277 B
Common Lisp

(load "../lang/functions.lisp")
(defun build (n lst)
(if (= n 0) lst
(build (- n 1) (cons (car lst) lst))))
(defun build2 (n lst)
(if (= n 0) lst
(build2 (- n 1) (build 200 lst))))
(length (build2 200 (build2 200 (build2 200 (build2 200 '(1 1 1 1 0 0 0 0))))))