Untitled

 avatar
unknown
plain_text
a year ago
376 B
86
Indexable
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