Skip to content

Instantly share code, notes, and snippets.

@setupminimal
Created June 5, 2015 14:23
Show Gist options
  • Save setupminimal/470c13a278562b8c6380 to your computer and use it in GitHub Desktop.
Save setupminimal/470c13a278562b8c6380 to your computer and use it in GitHub Desktop.
A module language that reverses s-expressions.
#lang racket
(provide (except-out (all-from-out racket)
#%module-begin)
(rename-out [module-begin #%module-begin]))
(define-syntax-rule (module-begin expr ...)
(#%module-begin
(eval (reverse-all '(expr ... begin)))))
(define (reverse-all item)
(if (list? item)
(reverse (map reverse-all item))
item))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment