Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
376 B
78
Indexable
Never
defun nod(tree k e)
  
(cond

    ((null arbore) nil)

    ((zerop k) (list e e))

    (t (mapcar (lambda (subL) (nod subL (- k 1) e)) L))))


MAPCAR: A proper list must not end with A

I also tried 

(defun tree (L x k e)

  (cond

    ((null L) nil)

    ((= x k) e)

    (t (mapcar #'(lambda (v) (tree v (+ 1 x) k e)) L))))

(print (tree '(a (b (c d)) (e (f (h)))) 0 2 'm))
Leave a Comment