Difference between revisions of "Z^3 Deeper Features"
Jump to navigation
Jump to search
(Created page with " ==Function Composition== Functions can be composed using the @ operator. A chain of functions can also be composed using the same technique. Composed function works left to...") |
|||
Line 7: | Line 7: | ||
a=(x=>x/3)@(x=>x+2); | a=(x=>x/3)@(x=>x+2); | ||
a(3) | a(3) | ||
− | <pre> | + | </pre> |
gives 3. | gives 3. | ||
Line 16: | Line 16: | ||
a=(x=>x+2)@(x=>x/3); | a=(x=>x+2)@(x=>x/3); | ||
a(3) | a(3) | ||
− | <pre> | + | </pre> |
gives | gives | ||
1.6666666666666667 | 1.6666666666666667 | ||
Line 23: | Line 23: | ||
a=(SIN@COS@TAN); | a=(SIN@COS@TAN); | ||
a(45) | a(45) | ||
− | <pre> | + | </pre> |
gives | gives | ||
0.7749904090605793 | 0.7749904090605793 |
Revision as of 13:46, 5 January 2024
Function Composition
Functions can be composed using the @ operator. A chain of functions can also be composed using the same technique. Composed function works left to right.
a=(x=>x/3)@(x=>x+2); a(3)
gives 3.
First 3 is divided by 3, and then 2 is added to yield 3 as result.
a=(x=>x+2)@(x=>x/3); a(3)
gives 1.6666666666666667
a=(SIN@COS@TAN); a(45)
gives 0.7749904090605793