lisp - Write a function that takes a number as its argument and construct a list -
i start learning lisp, , have question need help.
write function new-list takes number argument , constructs list of length containing t.
this try, doesn't work. me figure out?
(defun same-length (x) (make-list x:initial-element 't))
thanks in advance.
you're there:
* (defun make-t (size) (make-list size :initial-element t)) make-t * (make-t 10) (t t t t t t t t t t) *
:initial-element
keyword parameter, refer functions of common lisp more info. , please refer doc of make-list
more info , examples.
Comments
Post a Comment