10 Patterns🔗

Many of Raqit’s binding forms, including def, let and loop bind by matching patterns. In addition to Racket’s patterns, Raqit defines a few of its own.

[: v ...] matches and destructures lists. It’s equivalent to Racket’s list* pattern.

#{e ...} matches and destructures sets. To match subsets, use the wildcard sequence pattern, e.g., #{e₁ e₂ _ ...}.

{k v ...} matches and destructures hashes. To match only some keys (the most common case), use the wildcard sequence pattern, e.g., {k v _ ...}. Note that the wildcard sequence pattern here must come at the end.