(define mystery2
(lambda (L)
(if (null? L)
L
(begin
(displayln L)
(append (mystery2 (cdr L))
(list (car L)))))))
and I run it by (mystery2 '((1 2) (3 4) 5 6))
Here, I am not sure what "begin" function does.
Also, when I write "displayln L" it only gives us ((1 2) (3 4) 5 6)). Shouldn't it print out decreasing values since it is a recursion?
Please, help me understand why "begin" is used here and displayln works like that.
There is no problem in the code itself.
mysteryand not itself so we can't say it's recursive. It may be mutual recursive butmysteryneeds to callmystery2. - Sylwester