1

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?

Óscar López
  • 232,561
  • 37
  • 312
  • 386
  • 1
    Does 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 Answers1

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