Destroy all cons node in s-expression

Any ideas how to do this? I am trying not to create new nodes.

+2


source to share


2 answers


Call nreverse .



+3


source


Draw a standard cons-cell layout that looks like a list of 5 elements. This should give you a big clue right there.



Remember to keep a reference to the last cell in the list, which will be your new head of the list when it ends.

+1


source







All Articles