Function composition: Difference between revisions

m
Update Lang example: Fix spelling of Lang
(Add an example for Janet)
m (Update Lang example: Fix spelling of Lang)
Line 1,802:
$x = 5
 
# In langLang this task can be achieved with the concat operator
parser.op(fp.g ||| fp.f)($x) # Prints 21 [Internal execution: fp.f(fp.g($x))]
 
Line 1,808:
fp.compose = (fp.f, fp.g) -> {
fp.innerFunc = (fp.f, fp.g, $x) -> return fp.f(fp.g($x))
return fn.argCnt1(fn.combA3(fp.innerFunc, fp.f, fp.g)) # fn.combA3 must be used, because langLang does not support closures
}
 
168

edits