Macros training schemes. Help me write a define-syntax rule

I am new to Scheme Macros. If I have only one template and I want to combine syntax and syntax rules, how to do this?

(define-syntax for
  (syntax-rules (from to)
    [(for i from x to y step body) ...]
    [(for i from x to y body) ...]))

If I have only one, how can I combine the syntax definition and the rule?

Thanks.

+3
source share
1 answer

In other words, you decided that you forreally only need one template and want to write something like:

(defmacro (for ,i from ,x to ,y step ,body)
  ; code goes here
  )

There is nothing built into Scheme that makes macros with a single template write faster. The traditional solution (surprise!) Is to write another macro.

defsubst PLT Scheme define-syntax-rule, . , define-syntax-rule , - , "" "". , defsubst, define-syntax-rule .

+4

Source: https://habr.com/ru/post/1718956/


All Articles