Last active
May 16, 2017 01:30
-
-
Save greghendershott/e769d95bfc77d493992fe37ad7c7db57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; A fairly simple Racket program like this: | |
(module m racket/base | |
(define (f xs) | |
(for/list ([x (in-list xs)]) | |
(add1 x))) | |
(f '(1 2 3 4))) | |
;; Fully expanded with: | |
;; | |
;; (println (syntax->datum (expand (with-input-from-file "foo.rkt" read-syntax)))) | |
;; | |
;; Is something like this: | |
;; | |
;; (module m racket/base | |
;; (#%module-begin (module configure-runtime '#%kernel (#%module-begin | |
;; #(#%require racket/runtime-config) (#%app configure '#f))) | |
;; #(define-values (f) (lambda (xs) (#%app alt-reverse (let-values | |
;; #(((lst) xs)) (if (#%app list? lst) (#%app void) (let-values () | |
;; #(#%app in-list lst))) (#%app (letrec-values (((for-loop) (lambda | |
;; #(fold-var lst) (if (#%app pair? lst) (let-values (((x) (#%app | |
;; #unsafe-car lst))) (if '#t (let-values (((fold-var) (let-values | |
;; #(((fold-var) fold-var)) (let-values (((fold-var) (let-values () | |
;; #(#%app cons (let-values () (#%app add1 x)) fold-var)))) (#%app | |
;; #values fold-var))))) (if '#t (#%app for-loop fold-var (#%app | |
;; #unsafe-cdr lst)) fold-var)) fold-var)) fold-var)))) for-loop) null | |
;; #lst))))) (#%app call-with-values (lambda () (#%app f '(1 2 3 4))) | |
;; #print-values))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment