Skip to content

is a simple hygienic macroexpander for and in Carp

Notifications You must be signed in to change notification settings

carpentry-org/expand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

expand.carp

is a simple hygienic macroexpander in and for Carp.

It’s based on this talk by Matthew Flatt and implements the simple nano expander. I intend to keep working on it when motivation strikes.

(load "expand.carp")

(defdynamic prog
  (Expand.introduce ; adds all the core primitives
    (Expand.from-datum ; builds a syntax object
      '(let-syntax [add (fn [s] (quote-syntax '(+ 1 3)))]
        (add)))))

; expands the syntax object and converts it back to
; regular Carp
(Expand.to-datum (Expand.expand-all prog))
; => '(+ 1 3)

Have fun!

About

is a simple hygienic macroexpander for and in Carp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published