Liking cljdoc? Tell your friends :D
Clojure only.

com.mckayfleming.match-bits


match-bitscljmacro

(match-bits num & clauses)

Destructure a number by patterns of bits. Takes an expression that evaluates to a number, followed by a series of pattern symbols and bodies. A pattern symbol starts with % and is followed by a series of 0s, 1s, and other alphabetic characters. A pattern matches when the 0s and 1s match the same positions in the number. The other positions in the number will be destructured and bound to variables based on their character. For instance, 01aa01 will match 011001 and will bind the symbol a to 10 in the case body. Alphabetic characters must be contiguous. 01a1a0 is illegal.

Destructure a number by patterns of bits. Takes an expression that evaluates to a number,
followed by a series of pattern symbols and bodies. A pattern symbol starts with % and is followed
by a series of 0s, 1s, and other alphabetic characters. A pattern matches when the 0s and 1s match
the same positions in the number. The other positions in the number will be destructured and bound
to variables based on their character. For instance, 01aa01 will match 011001 and will bind the
symbol a to 10 in the case body. Alphabetic characters must be contiguous. 01a1a0 is illegal.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close