Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Convert a combinator expression to a directed acyclic graph (DAG)
| ResourceFunction["CombinatorToDAG"][cmb] displays the combinator expression cmb as a directed acyclic graph, splitting the expression into heads and parts down to the level of atoms. | |
| ResourceFunction["CombinatorToDAG"][cmb,t] displays the possible subexpressions of the combinator expression cmb if cmb were allowed to evolve t steps, assuming the S and K combinator transformation rules. | |
| ResourceFunction["CombinatorToDAG"][rules,cmb,t] displays the possible subexpressions of the combinator expression cmb if cmb were allowed to evolve t steps via the possible transformations in the list rules. | 
| "SKGlyphs" | {CombinatorS, CombinatorK} | symbols used to specify default transformation rules | 
| "ShowCausalGraph" | False | whether to display causal graph of combinator evolution | 
Display a combinator expression as a directed acyclic graph:
| In[1]:= | 
| Out[1]= |  | 
Demonstrate how an initial combinator expression can be evolved over a single step:
| In[2]:= | 
| Out[2]= |  | 
Show the same DAGs, but this time labeled to clarify how the evolution works. A light purple dotted edge indicates direct application of a transformation rule, whereas a dark purple dotted line indicates application of a transformation rule to a subexpression:
| In[3]:= | 
| Out[3]= |  | 
Evolve a combinator expression over 2 steps using a specified rule:
| In[4]:= | 
| Out[4]= |  | 
Evolve a combinator expression over 2 steps using the default rules with specified glyphs for the S and K combinators:
| In[5]:= | 
| Out[5]= |  | 
Display a causal graph of update events for a certain step of a combinator evolution (yellow nodes correspond to light purple arrows in the DAG representation, and gray nodes correspond to dark purple arrows):
| In[6]:= | 
| Out[6]= |  | 
When a combinator expression reaches its fixed point (such that transformation rules can no longer be applied), the causal graph will cease to change:
| In[7]:= | 
| Out[7]= | 
| In[8]:= | 
| Out[8]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License