I asked several days ago about finding the most deeply nested lists. I implemented the idea that was given, and it works.
But there is another problem: I also need to build a list from the nested list. meaning: If I change (8)
and (10 11 12)
, to leaf1 and leaf2, I need to return: '(ans (leaf1 (8)) (leaf2 (10 11 12))
. /ans is a quote
In other words:
my function will get
(1 (2 3) (4 (5) (7 (8) (10 11 12))))))
=> the most nested lists are (8)
and (10 11 12)
=> my function will return '(ans (leaf1 (8)) (leaf2 (10 11 12))
.
I am trying to find an idea, not an implementation. Thanks.