[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7 Pattern Matching
Pattern matching is a key feature of most modern functional programming languages since it allows clean and secure code to be written. Internally, “pattern-matching forms” should be translated (compiled) into cascades of “elementary tests” where code is made as efficient as possible, avoiding redundant tests; Bigloo’s “pattern matching compiler” provides this. The technique used is described in details in [QueinnecGeffroy92], and the code generated can be considered optimal (3) due to the way this “pattern compiler” was obtained.
The “pattern language” allows the expression of a wide variety of patterns, including:
- Non-linear patterns: pattern variables can appear more than
once, allowing comparison of subparts of the datum (through
eq?
) - Recursive patterns on lists: for example, checking that the
datum is a list of zero or more
a
s followed by zero or moreb
s. - Pattern matching on lists as well as on vectors and structures, and record types.
7.1 Bigloo pattern matching facilities | ||
7.2 The pattern language |
This document was generated on March 31, 2014 using texi2html 5.0.