I'm a newbie in Lisp, and i have some problems with some simple code.
1) My first problem is like this: I have a tree in Lisp like with this representation: (A 2 B 0 C 2 D 0 E 0) , which would be equivalent with (A (B) (C (D) (E))). I need to know how could I obtain the Postorder Traversal Sequence for the first representation. I figured out how to do it for the second representation of the tree, but I can't do it for the first one. Please help me if you can.
At this problem, I tried something, but it didn't work:
((null l) nil)
(t(cons(post(caddr l))(car l))))
For the other 2 problems, i have to make non-recursive functions, I have to resolve it iteratively (I'm not sure if this is the right word):
2) I have 2 lists, and I need to make a function that makes an association list between those 2 lists. For eg, (A B C) (X Y Z) --> ((A.X) (B.Y) (C.Z))
3) a) I have a list with atoms and I want to make another list that shows for every atom, how many times it appears in the list, something like this:
(A B A B A C A) --> ((A 4) (B 2) (C 1))
b) A function that counts the atoms from a list, something like: (A (B C) D E) --> 3 or (A B C) --> 3
Thank you very much in advance, and please help me if you can, it's very important to me.
Have a nice day!