I’m new to scheme. When I run the following code
(define lst '(1))
(let ((func1 (lambda lst
(begin (display lst)
lst))))
(begin (display lst)
(func1 lst)))
I got (1)((1))'((1)), which means lst displays as (1) when called in the fourth line, but when send it to the function func1, it becomes ((1)). What exactly happened here?
(lambda Args E)means: bind the variable-length argument list of this function toArgs. E.g.will print
(got 3 arguments). If you change thelambdaexpression tothen the function will print, and return, its single argument.