Hey so I have kind of been struggling with this question, i've been playing around with different combinations but I cannot seem to think of a function that will cause the list to produce itself. Does anyone have an idea?
Asked
Active
Viewed 60 times
1
-
1Does this answer your question? [Scheme: Iterative process to reconstruct a list in original order?](https://stackoverflow.com/questions/63827368/scheme-iterative-process-to-reconstruct-a-list-in-original-order) – alinsoar Nov 22 '20 at 21:32
1 Answers
2
Sure, it's pretty straightforward. You just have to use the same procedure that was used to construct the list in the first place: cons
.
(define lst '(1 2 3 4 5))
(foldr cons '() lst)
=> '(1 2 3 4 5)

Óscar López
- 232,561
- 37
- 312
- 386
-
Thank you so much! I was actually a bit confused at first didn't think of it that way! – fintechgenie Nov 22 '20 at 22:34