RosettaCodeData/Task/First-class-functions/Lambdatalk/first-class-functions.lambdatalk
2017-09-25 22:28:19 +02:00

14 lines
352 B
Text

{def cube {lambda {:x} {pow :x 3}}}
{def cuberoot {lambda {:x} {pow :x {/ 1 3}}}}
{def compose {lambda {:f :g :x} {:f {:g :x}}}}
{def fun sin cos cube}
{def inv asin acos cuberoot}
{def display {lambda {:i}
{br}{compose {nth :i {fun}}
{nth :i {inv}} 0.5}}}
{map display {serie 0 2}}
Output:
0.5
0.49999999999999994
0.5000000000000001