Can anyone give me some hints about this question(Family tree)?
-
30-10-2019 - |
Вопрос
It comes from my homework assignments. There is a family tree
a + b
/ | | \
c+u d+c e+w f
/ | \ / \
m+x n+y o p q
|
r
a and b is the oldest. and every married people the second person is not part of the original family. Now I need to write the spouse, sibling, children ,grandchildren, parents and grandparents function.
I wrote the list as below: ( (father mother) chlid1 child2 child3)
(((a b) c d e f) ((c u) m n o) ((d v) nil) ((e w) p q) (f nil) ((m x) r) ((n y) nil) (o nil) (p nil) (q nil) )
I have some problems with sibling function, here is my code.
(defun sibling (arglst lst)
(cond
((eql
arglst (cdr (car lst)))
(rest (cdr lst))
)
(T (sibling (rest lst) arglst))
)
I knew it was wrong, but I don't how to revise it.. and I also need some help with other functions. hope can get some hints from u guys.
Нет правильного решения
Не связан с StackOverflow