OrderlessPatternSequence

OrderlessPatternSequence[p1,p2,]

is a pattern object that represents a sequence of arguments matching p1,p2, in any order.

Details

Examples

open allclose all

Basic Examples  (3)

Match elements of a list in any order:

Match function arguments in any order:

The ordering of matched expressions is preserved:

Scope  (2)

Use OrderlessPatternSequence to make some of the function arguments orderless:

Only the last two arguments of g are orderless:

Find the positions of lists that have two 1s and one 0:

Properties & Relations  (1)

During expression pattern matching, PatternSequence matches expressions in fixed order:

OrderlessPatternSequence matches expressions in arbitrary order:

Possible Issues  (1)

OrderlessPatternSequence matches against a sequence of patterns:

Introduced in 2015
 (10.1)