Hi Matt,
In the definition of expand-ask-breed you have:
(syntax/loc stx
(define-syntax (ask-breed stx-inner)
(syntax-parse stx-inner
[(_ bodies (... ...))
(syntax/loc stx-inner
(for ([critter breed-vec])
(parameteriz
Hi all,
I have improved my question. In asking it, I'm trying to make sure I
understand things so that I can ultimately ask fewer questions (about
this). Apologies for the verbosity; it exposes more surface for confusion
to be corrected.
I read Matthew's "Macros as scopes" last night before going
Ha! A new question!
1. My macro expands. I use the macro expander (which is wonderful), and
everything looks good.
2. In my code, Racket helpfully claims the identifier that I believe should
be bound, is not bound.
3. I copy the expanded macro from the expander.
4. I comment out the macro use site
I'm wondering if...
https://stackoverflow.com/questions/41102630/transforming-a-list-of-symbols-to-a-list-of-identifiers-to-be-used-in-a-macro
is what I'm looking for (he says, answering himself)...
(define-syntax (introduce stx)
(syntax-case stx ()
[(_ tag ids ...)
(with-syntax ([(ge
Hi Matt,
The following is one way to define the macro.
The recipe is as follows:
1. Define format-functions that produce the identifiers needed.
2. Write the template (the syntax/loc expression) using the generated names
3. Wrap the template with a with-syntax that binds the generated names
t
Many thanks, John.
I've made it that far. I'll be more specific...
Conceptually, I want...
(define-syntax (introduce stx)
(syntax-case stx ()
[(_ tag ids ...)
(with-syntax ([(getters ...)
(map (λ (id) (format-id #'tag "~a-get-~a" tag id)) ids
...)])
#`(begin
In answer to at least one of your questions, top-level “begin”s are “spliced”
into their context to produce top-level bindings. So, for instance,
#lang racket
(begin
(define a 3)
(define b 4))
(+ b a)
… evaluates to 7
I think this is not the only issue you’re going to run into, but it’s a
7 matches
Mail list logo