Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Tools for the lambda calculus
Contributed by: Nik Murzin, Willem Nielsen and Stephen Wolfram
This paclet provides basic functionality to work with lambda expressions expressed with De Bruijn indices and more.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["Wolfram/Lambda"]
To load the code after installation, evaluate this code:
Needs["Wolfram`Lambda`"]
Create a lambda term using (aka formal λ, \[FormalLambda] or .Lambda):
In[1]:= | ![]() |
Or any symbols with name λ:
Parse lambda from a string:
In[2]:= | ![]() |
Out[2]= | ![]() |
In[3]:= | ![]() |
Out[3]= | ![]() |
Generate 10 random lambda expressions with depth 3 and maximum sub-expression length of 2:
In[4]:= | ![]() |
Out[4]= | ![]() |
Evaluate lambda expression:
In[5]:= | ![]() |
Out[5]= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
Convert lambda to different forms:
In[7]:= | ![]() |
Out[8]= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
In[10]:= | ![]() |
Out[10]= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
In[15]:= | ![]() |
Out[15]= | ![]() |
In[16]:= | ![]() |
Out[16]= | ![]() |
In[17]:= | ![]() |
Out[17]= | ![]() |
In[18]:= | ![]() |
Out[18]= | ![]() |
In[19]:= | ![]() |
Out[19]= | ![]() |
In[20]:= | ![]() |
Out[20]= | ![]() |
In[21]:= | ![]() |
Out[21]= | ![]() |
Colorize lambda:
In[22]:= | ![]() |
Out[23]= | ![]() |
In[24]:= | ![]() |
Out[24]= | ![]() |
Annotate lambda with smiles:
In[25]:= | ![]() |
Out[25]= | ![]() |
Make a graphical representation of the lambda:
In[26]:= | ![]() |
Out[26]= | ![]() |
Enumerate and visualize all lambda expression up-to depth 2 and length 2:
In[27]:= | ![]() |
Out[27]= | ![]() |
Evaluate lambdas:
In[28]:= | ![]() |
Out[28]= | ![]() |
Perform η-reduction:
In[29]:= | ![]() |
Out[29]= | ![]() |
Make lambda from a Function:
In[30]:= | ![]() |
Out[30]= | ![]() |
Turn a random lambda expression to a Function and back:
In[31]:= | ![]() |
Out[31]= | ![]() |
In[32]:= | ![]() |
Out[32]= | ![]() |
In[33]:= | ![]() |
Out[33]= | ![]() |
Make lambda from a combinator:
In[34]:= | ![]() |
Out[34]= | ![]() |
Evaluate Church numerals:
In[35]:= | ![]() |
Out[35]= | ![]() |
Define arithmetic functions:
In[36]:= | ![]() |
In[37]:= | ![]() |
Out[37]= | ![]() |
Evaluate Ackermann function:
In[38]:= | ![]() |
In[39]:= | ![]() |
Out[39]= | ![]() |
Iterate a single sub-evaluation:
In[40]:= | ![]() |
Out[40]= | ![]() |
Trace a non-terminating lambda expression and visualize the intermediate steps in many different ways:
In[41]:= | ![]() |
Out[41]= | ![]() |
In[42]:= | ![]() |
Out[42]= | ![]() |
Make multiway graphs of β-reductions with highlighted normal ordering reduction path:
In[43]:= | ![]() |
Out[44]= | ![]() |
Wolfram Language Version 14.2