Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Patterns

Guides

  • Guide
  • MainGuide

Tech Notes

  • Match & Replace

Symbols

  • MatchBindings
  • MatchParts
  • MultiwayReplace
  • NameValuePattern
  • PatternMatch
Wolfram`Patterns`
MultiwayReplace
​
​
MultiwayReplace[rules,inits]
return a lazy tree produced by applying
rules
to a list of initial conditions
inits
at all possible positions.
​
Examples  
(1)
Basic Examples  
(1)
In[1]:=
MultiwayReplace
[{s[x_][y_][z_]x[z][y[z]],k[x_][y_]x},s[k[s][i]][x][y]]
Out[1]=
LazyList
{s[k[s][i]][x][y]
…
​
,
…
}

In[2]:=
MultiwayReplace
[{s[x_][y_][z_]x[z][y[z]],k[x_][y_]x},s[k[s][i]][x][y]]//NormalLazy
Out[2]=


In[3]:=
ResourceFunction["MultiwayCombinator"][{y[f_]f[y[f]],y[f_][x_]f[y[f]][x]},y[f][y[x]],4,"StatesGraph"]//VertexList
Out[3]=
{y[f][y[x]],f[y[f]][y[x]],y[f][x[y[x]]],f[f[y[f]]][y[x]],f[y[f]][x[y[x]]],y[f][x[x[y[x]]]],f[f[f[y[f]]]][y[x]],f[f[y[f]]][x[y[x]]],f[y[f]][x[x[y[x]]]],y[f][x[x[x[y[x]]]]],f[f[f[f[y[f]]]]][y[x]],f[f[f[y[f]]]][x[y[x]]],f[f[y[f]]][x[x[y[x]]]],f[y[f]][x[x[x[y[x]]]]],y[f][x[x[x[x[y[x]]]]]]}
In[4]:=
LazyFindPath
MultiwayReplace
[{y[f_]f[y[f]],y[f_][x_]f[y[f]][x]},y[f][y[x]]],Labeled[f[y[f]][x[x[x[y[x]]]]],_]
Out[4]=
LazyComputation
…
Method: FindPath
​
Pattern:
f[y[f]][x[x[x[y[x]]]]]
_
Paths: {{1,3,1,2,2}}
Options: ​
​

In[5]:=
MultiwayReplace
[{y[f_]f[y[f]],y[f_][x_]f[y[f]][x]},y[f][y[x]]]1,3,1,2,2
Out[5]=
f[y[f]][x[x[x[y[x]]]]]
{1,1,1}

…
RelatedGuides
▪
MainGuide
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com