(defun generate (items limit) ; prepare computation of problem list... (setf problem-list (list ())) ; we need an empty list that can be appended (dotimes (i items) ; compute the randoms... (setf random (list (random (+ limit 1)))) ; add them to the empty list. list looks now like ; (NIL random1 random2 random3 ... randomX) (setf problem-list (append problem-list random)) ) ; now, generate problem (list 'make (random (+ limit 1)) 'from ; do not show NIL, which must be first element (cdr problem-list) ) ; end list ) ; end defun (defun display-problems (number items limit) (dotimes (i number) (princ "p") (prin1 (+ i 1)) (princ " = ") (prin1 (generate items limit)) (terpri) ) ; end dotimes ) ; end dotimes