# macro/unquote The escape hatch inside `macro/quote` — substitute a parameter (or any expression) into an otherwise-literal code template.
[macro/unquote $expr]
## Where it's used `macro/unquote` is only meaningful inside `[macro/quote ...]`. Inside plain macro bodies, `$param` is substituted directly; inside `[macro/quote ...]`, `$param` is preserved as a literal symbol — `[macro/unquote $param]` opts back in to substitution. | Context | `$param` substituted? | |---------|----------------------| | plain macro body | Yes | | `[macro/quote ...]` | No — use `[macro/unquote $param]` to substitute | | `[macro/syntax-quote ...]` | Yes (no unquote needed) | ## Example
defmacro unless {|cond body|
    [macro/quote [if [macro/unquote $cond] nil [macro/unquote $body]]]
}

[unless false { echo "ran" }]
# expands to: [if false nil { echo "ran" }]
Here `[macro/unquote $cond]` substitutes the literal `false` AST, and `[macro/unquote $body]` substitutes the `{ echo "ran" }` block. ## Important: use `[...]`, not `(...)` Deft's bare `( ... )` parens are infix-only (e.g. `($a + $b)`). `(macro/unquote $x)` is a syntax error — the parser will mis-handle it. Always write `[macro/unquote $x]` with brackets. ## Variants | Form | Effect | |------|--------| | `[macro/unquote $expr]` | Substitute `$expr`'s value as a single element | | `[macro/unquote-splice $list]` | Inline the elements of `$list` into the parent form | | `[macro/splice $list]` | Alias for `macro/unquote-splice` | ## See Also `macro/quote`, `macro/syntax-quote`, `macro/splice`, `defmacro`