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?
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)