This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Built-in Functions / Programming / Pattern Matching /


FilledSmallSquare Flat is an attribute that can be assigned to a symbol f to indicate that all expressions involving nested functions f should be flattened out. This property is accounted for in pattern matching.

FilledSmallSquare Flat corresponds to the mathematical property of associativity.

FilledSmallSquare For a symbol f with attribute Flat, f[f[a, b], f[c]] is automatically reduced to f[a, b, c].

FilledSmallSquare Functions like Plus, Times and Dot are Flat.

FilledSmallSquare For a Flat function f, the variables x and y in the pattern f[x_, y_] can correspond to any sequence of arguments.

FilledSmallSquare The Flat attribute must be assigned before defining any values for a Flat function.

FilledSmallSquare See Section 2.3.7 and Section 2.6.3.

FilledSmallSquare See also: Orderless, OneIdentity.

FilledSmallSquare New in Version 1.

Further Examples