Skip to content

Explanation of "pattern" is still confusing to me. #280

Closed
@BedfordWest

Description

@BedfordWest

I was going through the old book and had a hard time fully understanding what exactly a "pattern" is. The book immediately started out by describing how patterns were used in variable bindings and match expressions, but not with any sort of definition of what they actually are.

I looked at the current status of the new book and, while the examples are definitely a bit clearer, the pattern section still seems to focus on the how rather than the what.

We've actually used patterns a few times so far: they're used in let bindings, in function arguments, and in the match expression. Patterns have a lot more abilities than we have demonstrated so far, so we'll cover some of the most commonly used ones in this section. Any of these abilities work in any place where a pattern is used.

This simply states we've used patterns before and immediately leads into examples. What would help me understand patterns is to lead with something similar to the following: "a pattern is any ______ which is of the format _______." I attempted to find this information in the reference documentation, but could not find it there, either.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions