[Web site restructuring. Every document driving the web sit is now in the web/ subdirectory, old directories doc and logos have ben deleted and the example program descriptions have been moved to the new location. nordland@csee.ltu.se**20081111135042] { hunk ./doc/summary/bindings.html 1 - - -Patterns and bindings - - - - -

Patterns and bindings

- -

Patterns and pattern matching

-

-Patterns occur in several syntactic contexts in Timber (e.g. in the left hand sides of bindings, lambda expressions -and case alternatives). Syntactically, patterns form a subset of expressions; a pattern is one of the following: -

-

-At run-time, patterns are matched against values. Pattern-matching may succeed or fail; in the former case the result -is a binding of the variables in the pattern to values. The rules are as follows: -

-

-The special "wildcard" variable _ may be used in patterns; in contrast to other variables, it is not bound - by pattern-matching. -

- A consequence of the way pattern-matching is done is that patterns must be linear; no variable may occur more than once in - a pattern. - -

Bindings

-

-Syntactically, bindings are divided into type signatures and equations. Equations are either function bindings, pattern bindings - or instance bindings for implicit struct types. - -

-

-The order between bindings in a sequence of bindings is not significant, with the following exceptions: -

-

-Function bindings are recursive. For pattern bindings certain limited forms of recursion are possible, in order -to build finite, cyclic data structures. To be described more... - rmfile ./doc/summary/bindings.html hunk ./doc/summary/default.html 1 - - -Default declarations - - - - -

Default declarations

-

-Default declarations come in two distinct forms. They share the keyword default and they both -affect instances for implicit struct types, but otherwise they serve quite different purposes. -