(when (eql tail object)
(return-from tailp t))))
+(defun make-list (size &key (initial-element nil))
+ "Create a list of size `size` of `initial-element`s."
+ (when (< size 0)
+ (error "Size must be non-negative"))
+ (let ((newlist))
+ (do ((i 0))
+ ((= i size))
+ (push initial-element newlist)
+ (incf i))
+ newlist))
+
(defun map1 (func list)
(with-collect
(while list
(test (equal (let ((thing '())) (butlast thing 2)) '()))
(test (equal (let ((thing '(1 2))) (butlast thing 2)) '()))
(test (equal (let ((thing '())) (butlast thing 0)) '()))
+
+;; MAKE-LIST
+(test (equal (make-list 5) '(nil nil nil nil nil)))
+(test (equal (make-list 3 :initial-element 'rah) '(rah rah rah)))