Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Encode an SK combinator expression into a list of 0s and 1s
ResourceFunction["CombinatorEncode"][comb] encodes the combinator expression comb (composed of the symbols s and k) as a list of 0s and 1s. | |
ResourceFunction["CombinatorEncode"][comb, fmt] yields the encoding of comb in the format fmt. |
00 | |
01 | |
1 |
CombinatorSymbols | Automatic | which combinator symbols should be used instead of s and k |
Encode a combinator expression into a unique list of 1s and 0s:
In[1]:= |
|
Out[1]= |
|
Return the result of the encoding in various formats:
In[2]:= |
|
Out[2]= |
|
Specify which combinator symbols to encode instead of s and k:
In[3]:= |
|
Out[3]= |
|
Encode the five combinators that appear in Schönfinkel’s original paper:
In[4]:= |
|
Out[4]= |
|
Define a function for visualizing encodings:
Visualize states of a multiway combinator evaluation graph:
In[5]:= |
|
Out[5]= |
|
Plot the contraction of the Ω term, which reduces to itself after three steps:
In[6]:= |
|
Out[8]= |
|
Plot the successive applications of the successor function s[b] starting with k[i] (0):
In[9]:= |
|
Out[10]= |
|
Unknown symbols in the expression cannot be encoded:
In[11]:= |
|
Out[11]= |
|
In[12]:= |
|
Out[12]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License