Ion Fusion Documentation
Release 0.38a1-SNAPSHOT (2026-04-16T19:45:37.790Z)

Module /fusion/experimental/syntax_rules

Like Racket's pattern macros.

Known notable differences (beyond stylistic - vs. _ separators): * definesyntaxrules does not have a Racket-based equivalent * (syntaxrules and definesyntax_rule do have Racket-based precedents) * Racket's syntax_rules seems to have restriction that the variable before ... in the pattern must also come before it in the template. Not here. * Racket's definesyntaxalias -- define-type -- likely not rule-based

Also of note is that the ... (aka ellipsis or syntax Kleene star) can only occur at the end of a pattern, but can occur 0+ times anywhere in the template, even in the beginning or middle of a piece of the template.

For convenience -- like for shorthand accessing structs, symbols can be interpreted as strings instead (i.e. not evaluated in default Fusion context of binding/variable) by adding convertsymbolsto_strings:: annotation to applicable parts of the rule pattern.

The syntax rules procedures give nearly as much power/simplicity as a grammar. The ease of expressing re-write/transforms comes at performance cost though. This performance gap however may be substantially narrowed over time.

WARNING: This module while in experimental mode is unsupported and may change in behavior without notice. Also no strong guarantees of being defect-free. Of note that Racket has variable ... whereas these syntax rules do just ... This was an unnoticed interface difference that will eventually be remedied.

define_syntax_rule
define_syntax_rules
syntax_rules