zelphirkaltstahl <zelphirkaltst...@posteo.de> writes: > Hi Guile Users, > > I want to write a macro, which creates a procedure of given name, > where the given name is a not yet defined identifier. > Here is what I have so far: …
> Anyway, can you help me out writing the macro, fixing at least the 2 > issues or direct me to a tutorial, which covers how to write a macro > which gives basically a new define form? I can’t debug your form right now, but I can give you an example where I created macros to write macros: https://bitbucket.org/ArneBab/wisp/src/5e860c746ee02c764bf378aeb8f436a1a341bd5c/examples/enter-three-witches.scm#lines-209 The Enter-Macro defines a macro which outputs its arguments as text. It took me some time to get it right, but it works pretty well. Bits and pieces: - check for the presence of a macro-binding: (syntax-case x () ((_ (name more ...) b ...) ; new binding: only create it if the binding is not already a macro (not (eq? 'macro (syntax-local-binding (syntax name)))) - stay on the same level: #'(begin … (this is originally written in wisp and then transformed to scheme for easier sharing with other schemers: https://bitbucket.org/ArneBab/wisp/src/5e860c746ee02c764bf378aeb8f436a1a341bd5c/examples/enter-three-witches.w#lines-209 ) Best wishes, Arne -- Unpolitisch sein heißt politisch sein ohne es zu merken
signature.asc
Description: PGP signature