fork download
  1.  
  2. (define cwd (make-parameter "/home"))
  3.  
  4. (define (foo x)
  5. (displayln (cwd))
  6. (displayln x))
  7.  
  8. (define-syntax-rule (bar d body)
  9. (parameterize [(cwd (string-append (cwd) "/" d))]
  10. (begin body)))
  11.  
  12.  
  13. (foo 12)
  14. (bar "myuser"
  15. (begin
  16. (foo 12)
  17. (bar "another_dir"
  18. (foo 14))))
Success #stdin #stdout 0.43s 70780KB
stdin
Standard input is empty
stdout
/home
12
/home/myuser
12
/home/myuser/another_dir
14