Function composition: Difference between revisions

Update Lang example: Use new operation parser syntax and add print function calls
(Update Lang example: Use new operation parser syntax and add print function calls)
Line 1,799:
 
# In Lang this task can be achieved with the concat operator
fn.println(parser.op((fp.g ||| fp.f)($x))) # Prints 21 [Internal execution: fp.f(fp.g($x))]
 
# Creating a user-defined function doing the same thing is a bit more difficult
Line 1,807:
}
 
fn.println(fp.compose(fp.f, fp.g)($x)) # Prints also 21
</syntaxhighlight>
 
168

edits