How can I pass a variable by reference in scheme?
An example of the functionality I want:
(define foo (lambda (&x) (set! x 5))) (define y 2)
You can use a macro:
scheme@(guile-user)> (define-macro (foo var)`(set! ,var 5)) scheme@(guile-user)> (define y 2) scheme@(guile-user)> (foo y) scheme@(guile-user)> (display y)(newline) 5