RosettaCodeData/Task/First-class-functions/Elena/first-class-functions.elena

20 lines
464 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
import system'routines;
import system'math;
import extensions'routines;
import extensions'math;
extension op
{
compose(f,g)
= f(g(self));
}
2026-02-01 16:33:20 -08:00
public Program()
2023-07-01 11:58:00 -04:00
{
var fs := new object[]{ mssgconst sin<mathOp>[1], mssgconst cos<mathOp>[1], (x => power(x, 3.0r)) };
var gs := new object[]{ mssgconst arcsin<mathOp>[1], mssgconst arccos<mathOp>[1], (x => power(x, 1.0r / 3)) };
fs.zipBy(gs, (f,g => 0.5r.compose(f,g)))
2025-08-11 18:05:26 -07:00
.forEach(PrintingLn)
2023-07-01 11:58:00 -04:00
}