liveBook · Manning

Pattern

A pattern is a specification of criteria used to match values or text.

How 2 Manning books explain it

Learn Rust in a Month of Lunches

Pattern is a Rust string-matching trait implemented by supported search patterns such as string slices, characters, and closures.

How it is used
Introduces Pattern as the trait governing accepted search inputs for .match_indices().
How deep it goes
Names supported input types and demonstrates their use while deferring details of the trait.
Examples
Searches German text with a character-testing closure and the string slice ". ", printing matches and indices.
What you can do after
Apply it via .match_indices() to find matching text and its indices.

Read how Learn Rust in a Month of Lunches explains pattern →

Type-Driven Development with Idris

A syntactic form that describes the shape or value an input must match for a function clause to apply.

How it is used
Uses patterns to define function behavior for possible input shapes and values.
How deep it goes
Works through constructor discovery, interactive case splitting, variable binding, and recursive clauses.
Examples
Uses Boolean exclusive OR, recursive evenness on Nat, and word lengths over a list.
What you can do after
Apply it via Idris and Atom to split input cases and implement recursive functions.

Read how Type-Driven Development with Idris explains pattern →

Related concepts

Questions about pattern

What is pattern?

A pattern is a specification of criteria used to match values or text.

Which Manning books explain pattern?

Learn Rust in a Month of Lunches and Type-Driven Development with Idris.

What kinds of pattern are there?

Kinds of pattern include positional pattern, property pattern and complex url pattern.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.