From Meta, a Wikimedia project coordination wiki
This page is currently a draft. More information pertaining to this may be available on the talk page .
Translation admins: Normally, drafts should not be marked for translation.
The examples of function compositions and function declarations on this page show the ZObject's labelled in English on the left, and the actual representation (using ZIDs) on the right.
One argument, using a single builtin function (Z802/if).
Z12401/negation (Function)[ edit ]
{
"type" : "Function" ,
"arguments" : [{
"type" : "Argument declaration" ,
"argument type" : "Boolean" ,
"key" : "Z12401K1" ,
"label" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "x"
}]
}
}],
"return type" : "Boolean" ,
"testers" : [],
"implementations" : [
"negation implementation"
],
"identity" : "negation"
}
{
"Z1K1" : "Z8" ,
"Z8K1" : [{
"Z1K1" : "Z17" ,
"Z17K1" : "Z40" ,
"Z17K2" : "Z12401K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "x"
}]
}
}],
"Z8K2" : "Z40" ,
"Z8K3" : [],
"Z8K4" : [
"Z12402"
],
"Z8K5" : "Z12401"
}
Z12402/negation implementation (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "negation" ,
"composition" : {
"type" : "Function call" ,
"function" : "if" ,
"condition" : {
"type" : "Argument reference" ,
"argument" : "x"
},
"consequent" : "false" ,
"alternative" : "true"
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12401" ,
"Z14K2" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z802" ,
"Z802K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12401K1"
},
"Z802K2" : "Z42" ,
"Z803K3" : "Z41"
}
}
Two arguments, but still using only one single builtin function (Z802/if). Does return arguments in two different ways, once directly, once as a result from a builtin.
Z12411/and (Function)[ edit ]
{
"type" : "Function" ,
"arguments" : [{
"type" : "Argument declaration" ,
"argument type" : "Boolean" ,
"key" : "Z12411K1" ,
"label" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "left"
}]
}
}, {
"type" : "Argument declaration" ,
"argument type" : "Boolean" ,
"key" : "Z12411K2" ,
"label" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "right"
}]
}
}],
"return type" : "Boolean" ,
"testers" : [],
"implementations" : [
"and implementation"
],
"identity" : "and"
}
{
"Z1K1" : "Z8" ,
"Z8K1" : [{
"Z1K1" : "Z17" ,
"Z17K1" : "Z40" ,
"Z17K2" : "Z12411K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "left"
}]
}
}, {
"Z1K1" : "Z17" ,
"Z17K1" : "Z40" ,
"Z17K2" : "Z12411K2" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "right"
}]
}
}],
"Z8K2" : "Z40" ,
"Z8K3" : [],
"Z8K4" : [
"Z12412"
],
"Z8K5" : "Z12411"
}
Z12412/and implementation (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "and" ,
"composition" : {
"type" : "Function call" ,
"function" : "if" ,
"condition" : {
"type" : "Argument reference" ,
"argument" : "left"
},
"consequent" : {
"type" : "Argument reference" ,
"argument" : "right"
},
"alternative" : "false"
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12411" ,
"Z14K2" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z802" ,
"Z802K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12411K1"
},
"Z802K2" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12411K2"
},
"Z803K3" : "Z42"
}
}
Two arguments, as before. But this time we have two implementations, both compositions, and one of them makes nested function calls to the previous two functions.
Z12421/or (Function)[ edit ]
{
"type" : "Function" ,
"arguments" : [{
"type" : "Argument declaration" ,
"argument type" : "Boolean" ,
"key" : "Z12401K1" ,
"label" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "left"
}]
}
}, {
"type" : "Argument declaration" ,
"argument type" : "Boolean" ,
"key" : "Z12401K2" ,
"label" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "right"
}]
}
}],
"return type" : "Boolean" ,
"testers" : [],
"implementations" : [
"or implementation" ,
"or implementation with builtins"
],
"identity" : "or"
}
{
"Z1K1" : "Z8" ,
"Z8K1" : [{
"Z1K1" : "Z17" ,
"Z17K1" : "Z40" ,
"Z17K2" : "Z12421K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "left"
}]
}
}, {
"Z1K1" : "Z17" ,
"Z17K1" : "Z40" ,
"Z17K2" : "Z12421K2" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "right"
}]
}
}],
"Z8K2" : "Z40" ,
"Z8K3" : [],
"Z8K4" : [
"Z12422" ,
"Z12423"
],
"Z8K5" : "Z12421"
}
Z12422/or implementation (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "or" ,
"composition" : {
"type" : "Function call" ,
"function" : "negation" ,
"x" : {
"type" : "Function call" ,
"function" : "and" ,
"left" : {
"type" : "Function call" ,
"function" : "negation" ,
"x" : {
"type" : "Argument reference" ,
"argument" : "left"
}
},
"right" : {
"type" : "Function call" ,
"function" : "negation" ,
"x" : {
"type" : "Argument reference" ,
"argument" : "right"
}
}
}
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12421" ,
"Z14K2" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z12401" ,
"Z12401K1" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z12411" ,
"Z12411K1" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z12401" ,
"Z12401K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12421K1"
}
},
"Z12411K2" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z12401" ,
"Z12401K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12421K2"
}
}
}
}
}
Z12423/or implementation with builtins (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "or" ,
"composition" : {
"type" : "Function call" ,
"function" : "if" ,
"condition" : {
"type" : "Argument reference" ,
"argument" : "left"
},
"consequent" : "true" ,
"alternative" : {
"type" : "Argument reference" ,
"argument" : "right"
}
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12411" ,
"Z14K2" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z802" ,
"Z802K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12411K1"
},
"Z802K2" : "Z41" ,
"Z803K3" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12411K2"
}
}
}
This works on Z8/Functions. It could also work on Z1/object, i.e. anything. This used Z8 in order to align with tie I combinator in the lambda calculus.
Z12001/identity (Function)[ edit ]
{
"type" : "Function" ,
"arguments" : [
{
"type" : "Argument declaration" ,
"argument type" : "Function" ,
"key" : "Z12001K1" ,
"label" : {
"type" : "Multilingual text" ,
"texts" : [
{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "f"
}
]
}
}
],
"return type" : "Function" ,
"testers" : [],
"implementations" : [
"identity implementation"
],
"identity" : "identity"
}
{
"Z1K1" : "Z8" ,
"Z8K1" : [
{
"Z1K1" : "Z17" ,
"Z17K1" : "Z8" ,
"Z17K2" : "Z12001K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [
{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "f"
}
]
}
}
],
"Z8K2" : "Z8" ,
"Z8K3" : [],
"Z8K4" : [
"Z12002"
],
"Z8K5" : "Z12001"
}
Z12002/identity implementation (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "identity" ,
"composition" : {
"type" : "Argument reference" ,
"argument" : "f"
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12001" ,
"Z14K2" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12001K1"
}
}
This is a function that takes a function and applies that function to itself.
Uses for the first time a local key for an argument (see the K1 in the implementation).
As a stretch goal, Z12011 applied to Z12011 should recognise that it produces itself and is thus a fix point and should then return that fix point (i.e. the result of Z12011(Z12011)
should be Z12011(Z12011)
).
Z12011/self application (Function)[ edit ]
{
"type" : "Function" ,
"arguments" : [{
"type" : "Argument declaration" ,
"argument type" : "Function" ,
"key" : "Z12011K1" ,
"labels" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "f"
}]
}
}],
"return type" : "Function" ,
"testers" : [],
"implementations" : [
"self application implementation"
],
"identity" : "self application"
}
{
"Z1K1" : "Z8" ,
"Z8K1" : [{
"Z1K1" : "Z17" ,
"Z17K1" : "Z8" ,
"Z17K2" : "Z12011K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "f"
}]
}
}],
"Z8K2" : "Z8" ,
"Z8K3" : [],
"Z8K4" : [
"Z12012"
],
"Z8K5" : "Z12011"
}
Z12012/self application implementation (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "self application" ,
"composition" : {
"type" : "Function call" ,
"function" : {
"type" : "Argument reference" ,
"argument" : "f"
},
"K1" : {
"type" : "Argument reference" ,
"argument" : "f"
}
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12011" ,
"Z14K2" : {
"Z1K1" : "Z7" ,
"Z7K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12011K1"
},
"K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12011K1"
}
}
}
This is a function that takes a function x and returns a function that takes a function but returns the previously given function x no matter what the input was. This is called the K combinator (K as in constant). It provides some closure.
Checks that alpha conversion works. Also builds a function with a builtin implementation as a result.
Z12021/k combinator (Function)[ edit ]
{
"type" : "Function" ,
"arguments" : [{
"type" : "Argument declaration" ,
"argument type" : "Function" ,
"key" : "Z12021K1" ,
"labels" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "f"
}]
}
}],
"return type" : "Function" ,
"testers" : [],
"implementations" : [
"k combinator implementation"
],
"identity" : "k combinator"
}
{
"Z1K1" : "Z8" ,
"Z8K1" : [{
"Z1K1" : "Z17" ,
"Z17K1" : "Z8" ,
"Z17K2" : "Z12021K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "argument"
}]
}
}],
"Z8K2" : "Z8" ,
"Z8K3" : [],
"Z8K4" : [
"Z12022"
],
"Z8K5" : "Z12021"
}
Z12022/k combinator (Implementation)[ edit ]
{
"type" : "Implementation" ,
"function" : "k combinator" ,
"composition" : {
"type" : "Function" ,
"arguments" : [{
"type" : "Argument declaration" ,
"argument type" : "Function" ,
"key" : "K1" ,
"labels" : {
"type" : "Multilingual text" ,
"texts" : [{
"type" : "Monolingual text" ,
"language" : "en" ,
"text" : "x"
}]
}
}],
"return type" : "Function" ,
"testers" : [],
"implementations" : [{
"type" : "Implementation" ,
"function" : {
"type" : "Function call" ,
"function" : "k combinator" ,
"f" : {
"type" : "Argument reference" ,
"reference" : "f"
}
},
"composition" : {
"type" : "Argument reference" ,
"reference" : "f"
}
}],
"identity" : {
"type" : "Function call" ,
"function" : "k combinator" ,
"f" : {
"type" : "Argument reference" ,
"reference" : "f"
}
}
}
}
{
"Z1K1" : "Z14" ,
"Z14K1" : "Z12021" ,
"Z14K2" : {
"Z1K1" : "Z8" ,
"Z8K1" : [{
"Z1K1" : "Z17" ,
"Z17K1" : "Z8" ,
"Z17K2" : "K1" ,
"Z17K3" : {
"Z1K1" : "Z12" ,
"Z12K1" : [{
"Z1K1" : "Z11" ,
"Z11K1" : "en" ,
"Z11K2" : "argument"
}]
}
}],
"Z8K2" : "Z8" ,
"Z8K3" : [],
"Z8K4" : [{
"Z1K1" : "Z14" ,
"Z14K1" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z12021" ,
"Z12021K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12021K1"
}
},
"Z14K2" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12021K1"
}
}],
"Z8K5" : {
"Z1K1" : "Z7" ,
"Z7K1" : "Z12021" ,
"Z12021K1" : {
"Z1K1" : "Z18" ,
"Z18K1" : "Z12021K1"
}
}
}
}