AnyOrder
✖
AnyOrder
is a grammar rules pattern object that represents a sequence of elements matching p1, p2, … in any order.
Details

- AnyOrder appears inside GrammarRules and StringExpression objects.
- AnyOrder can be nested inside and outside FixedOrder, Alternatives, and other grammar rule patterns.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Extract elements of a string, which may appear in any order:

https://wolfram.com/xid/0cg41gdki-xudrgy

Deploy a grammar that allows phrases to appear in any order:

https://wolfram.com/xid/0cg41gdki-b2rfsv


https://wolfram.com/xid/0cg41gdki-t89c8c

Applications (1)Sample problems that can be solved with this function
Deploy a simple calculator that supports infix, Polish, and reverse Polish notation:

https://wolfram.com/xid/0cg41gdki-xl62m3


https://wolfram.com/xid/0cg41gdki-umiaou


https://wolfram.com/xid/0cg41gdki-tooxgf


https://wolfram.com/xid/0cg41gdki-9iorb8


https://wolfram.com/xid/0cg41gdki-ea9ym8

This calculator is not programmed to apply precedence to different operators:

https://wolfram.com/xid/0cg41gdki-2ah4j4

Properties & Relations (1)Properties of the function, and connections to other functions
In a grammar, FixedOrder requires a specific order and AnyOrder supports arbitrary order:

https://wolfram.com/xid/0cg41gdki-3pysx9

Here the input matches the order in the FixedOrder:

https://wolfram.com/xid/0cg41gdki-yspncq

The input does not match the order in the FixedOrder:

https://wolfram.com/xid/0cg41gdki-1sb5sn

Wolfram Research (2015), AnyOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/AnyOrder.html.
Text
Wolfram Research (2015), AnyOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/AnyOrder.html.
Wolfram Research (2015), AnyOrder, Wolfram Language function, https://reference.wolfram.com/language/ref/AnyOrder.html.
CMS
Wolfram Language. 2015. "AnyOrder." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AnyOrder.html.
Wolfram Language. 2015. "AnyOrder." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AnyOrder.html.
APA
Wolfram Language. (2015). AnyOrder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AnyOrder.html
Wolfram Language. (2015). AnyOrder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AnyOrder.html
BibTeX
@misc{reference.wolfram_2025_anyorder, author="Wolfram Research", title="{AnyOrder}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/AnyOrder.html}", note=[Accessed: 19-June-2025
]}
BibLaTeX
@online{reference.wolfram_2025_anyorder, organization={Wolfram Research}, title={AnyOrder}, year={2015}, url={https://reference.wolfram.com/language/ref/AnyOrder.html}, note=[Accessed: 19-June-2025
]}