The subject says "simple", but is not really a piece of cake for me

Please help me( I started learning LISP 5 days ago ).

Code: Select all

```
A
/ \
B C
/ \
D E
```

(A 2 B 0 C 2 D 0 E 0) (1)

(A (B) (C (D) (E))) (2)

->Convert a tree of type (2) to type (1).

This is my function:

____________________________________________________

Code: Select all

```
(defun conv2to1(l)
(cond
((atom (car l)) (cons (car l) (length (cdr l))))
(T (append (conv2to1(car l)) (conv2to1 (cdr l))))
)
)
```

I'm not sure where I'm wrong, but i think I'm very close to the result