Wolfram Research

Function Repository Resource:

SKCombinatorCompile

Source Notebook

Represent an expression in terms of the S and K combinators

Contributed by: Wolfram Research

ResourceFunction["SKCombinatorCompile"][expr,vars]

give a representation of expr with respect to vars in terms of the S and K combinators.

Details and Options

The second argument to ResourceFunction["SKCombinatorCompile"] can be a single variable or list of variables.
ResourceFunction["SKCombinatorCompile"] can take the following option:
"SKGlyphs" {CombinatorS,CombinatorK} symbols used to specify combinators

Examples

Basic Examples (2) 

Represent an expression in terms of the S and K combinators:

In[1]:=
ResourceFunction["SKCombinatorCompile"][f[g[x][y]][y], {x, y}]
Out[1]=

Recover the original expression by applying the combinator to variables and transforming:

In[2]:=
%[x][y] //. {CombinatorS[x_][y_][z_] -> x[z][y[z]], CombinatorK[x_][y_] -> x}
Out[2]=

Scope (3) 

Convert an expression with one variable:

In[3]:=
ResourceFunction["SKCombinatorCompile"][g[f[g[z]][z]][z], z, "SKGlyphs" -> {s, k}]
Out[3]=

Convert an expression with multiple variables:

In[4]:=
ResourceFunction["SKCombinatorCompile"][g[f[g[x][z]][y]], {x, y, z}, "SKGlyphs" -> {s, k}]
Out[4]=

Convert an expression where the variables specified are absent in the expression:

In[5]:=
ResourceFunction["SKCombinatorCompile"][g[f[g[x][z]][y]], {u, v}, "SKGlyphs" -> {s, k}]
Out[5]=

Resource History

Related Resources

License Information