[racket] How to either extend eval or write macros in #lazy?
For #2, can you give a more specific example?
For example, I can do this:
#lang lazy
(require (for-syntax racket/base))
(cons 1 (cons 2 (cons 3 null)))
(define-syntax econs
(syntax-rules () [(_ x y) (cons x (! y))]))
(econs 1 (econs 2 (econs 3 null)))
Welcome to DrRacket, version 5.3.4.11 [3m].
Language: lazy; memory limit: 8192 MB.
'(1 . #<promise>)
'(1 2 3)
>
On Mon, Jul 1, 2013 at 2:31 PM, Sean Kanaley <skanaley at gmail.com> wrote:
> I'm attempting to provide a package very soon with Haskell-like type classes
> initially including Monoid, Functor, and Foldable, however I've discovered
> the terrible bug that mappend is too strict when it expands into "or" or
> "and".
>
> Is there a way to extend eval from within #lang racket such that the user
> can still use #lang racket while I secretly have an extended version? I
> would then add a lazy-lambda construct without requiring the entire set of
> future racket programs written using this library to be lazy. In other
> words, if eval was a superclass or interface available in #lang racket,
> someone calling (mappend ...) would get the closure of some sort to be
> applied by this generic eval that I would implement internally to handle the
> fact that it's not a regular lambda. If not, then solution 2:
>
> #lazy ... simply using #lazy causes a couple issues:
>
> 1. define is not defined at phase1, solved by (require (for-syntax
> racket/base) ...)
>
> 2. define-syntax not valid in expression context etc. ... not sure how to
> solve ... it looks like #lazy doesn't permit internal definitions, but then
> how does one make a macro in lazy racket?
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users