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

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -