[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] A (somewhat) useful define-syntax example
From: |
Dan Leslie |
Subject: |
[Chicken-users] A (somewhat) useful define-syntax example |
Date: |
Sun, 26 Apr 2015 11:22:56 -0700 |
Earlier last week a bug was reported with the monad egg, and it exposed
a deep flaw in how the syntax was written. In trying to fix it I found
myself spinning my wheels and generally having a frustrating time of
it. Thus, I took it upon myself to strip the concepts to their minimal
and write a small example of the behaviour I wanted.
Namely:
1. Dynamically binding composed symbols at runtime
(awesome-macro word stuff)
becomes
(define awesome-word stuff)
2. Injecting bindings into quoted contexts
(awesome-macro word (if call-cthulhu (screech) (hum)))
becomes
(begin (if call-cthulhu (word) (hum)))
3. Interspersing behaviour into a quoted context
(awesome-macro splat (method1) (method2))
becomes
(begin (method1) splat (method2) splat)
And using those in a library, in csi, in csc, et al; and in composition
with one another. This would cover the needs of a fair number of
domain-specific languages, I think.
Anyhow, without further ado, you can find the example here:
https://github.com/dleslie/funky
PS, can anyone explain the comment here:
https://github.com/dleslie/funky/blob/master/funky.scm#L24
Thanks!
-Dan Leslie
- [Chicken-users] A (somewhat) useful define-syntax example,
Dan Leslie <=