Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pattern Types

Pattern TypeSyntaxDescriptionExample
Literal42, 'atom, "string"Match exact value(case x (42 'found))
Variablex, nameBind to any value(case x (n n))
Don't-care_Match anything, don't bind(case x (_ 'matched))
Cons(cons h t)Match list head/tail(case l ((cons h t) h))
List(list a b c)Match list of specific length(case x ((list a b) a))
Tuple(tuple 'ok value)Match tuple structure(case x ((tuple 'ok v) v))
Binary(binary (x (size 8)))Match binary segmentsSee below
Map(map 'key value)Match map with key(case m ((map 'a v) v))
Alias(= pattern1 pattern2)Match both patterns(= (cons h t) full-list)