daily pastebin goal
2%
SHARE
TWEET

Example2

a guest Feb 8th, 2013 27 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; ------------------------------------------------------------------------------------------
  2. ;; 1
  3. #lang racket/base
  4. (define (f)
  5.   (define z
  6.     (let ([x 10]
  7.           [y 10])
  8.     (+ x y)))
  9.   z)
  10. ; ==>
  11. (module test2 racket/base
  12.   (#%module-begin
  13.    (define-values (f)
  14.      (lambda ()
  15.        (let-values (((z)
  16.                      (let-values (((x) (quote 10)) ((y) (quote 10))) (#%app + x y)))) z)))))
  17.  
  18. ;; ------------------------------------------------------------------------------------------
  19. ;; 2
  20. #lang racket/base
  21. (define (f)
  22.   (define z
  23.     (let ()
  24.       (define x 10)
  25.       (define y 10)
  26.       (+ x y)))
  27.   z)
  28. ; ==>
  29. (module test2 racket/base
  30.   (#%module-begin
  31.    (define-values (f)
  32.      (lambda ()
  33.        (let-values (((z)
  34.                      (let-values ()
  35.                        (let-values (((x) (quote 10))) (let-values (((y) (quote 10))) (#%app + x y)))))) z)))))
  36.  
  37. ;; ------------------------------------------------------------------------------------------
  38. ;; 3
  39. #lang racket/base
  40. (require racket/block)
  41. (define (f)
  42.   (define z
  43.     (block
  44.      (define x 10)
  45.      (define y 10)
  46.      (+ x y)))
  47.   z)
  48. ; ==>
  49. (module test2 racket/base
  50.   (#%module-begin
  51.    (#%require racket/block)
  52.    (define-values (f)
  53.      (lambda ()
  54.        (let-values (((z)
  55.                      (let-values (((x) (quote 10))) (let-values (((y) (quote 10))) (#%app + x y))))) z)))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top