3 Racket Expressions from Rhombus
Using a Racket syntactic form from Rhombus requires a Rhombus macro that expands to the Racket form. A Rhombus macro can build a use of a Racket syntactic form using expr_meta.pack_s_exp, defn_meta.pack_s_exp, or decl_meta.pack_s_exp. Use expr_meta.pack_expr to pack a Rhombus expression for use within a packed S-expression form.
For example, the following shared macro expands to a use of the Racket shared form, which specifically recognizes uses of the Racket cons function.
expr.macro 'shared ($(id :: Identifier) = $rhs ...,
...):
$body
...':
expr_meta.pack_s_exp(['rkt_shared',
[[id, expr_meta.pack_expr('$rhs ...')],
...],
$body
...')])