Created
August 28, 2017 21:44
-
-
Save Glorp/739af1fa8793d944cbd35355fc81427c 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
#lang racket | |
(provide (rename-out [my-read read] | |
[my-read-syntax read-syntax])) | |
(define (my-read in) (syntax->datum (my-read-syntax #f in))) | |
(define (rev stx) | |
(define l (syntax->list stx)) | |
(if l | |
(datum->syntax stx (reverse (map rev l)) stx stx) | |
stx)) | |
(define (my-read-syntax src in) | |
(define blah #'e) | |
(define res | |
(let loop () | |
(define stx (read-syntax src in)) | |
(cond [(eof-object? stx) '()] | |
[else | |
(set! blah stx) | |
(cons (rev stx) (loop))]))) | |
(datum->syntax blah | |
`(module merp racket | |
,@res) | |
blah | |
blah)) |
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
#lang reader "baklengs.rkt" | |
((x x +) | |
(x double) define) | |
((3 2 1 list) double map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put both files in same dir, e.g. by downloading zip and unzipping somewhere. Run test.rkt with Racket. Should get the list '(2 4 6).