RosettaCodeData/Task/First-class-functions-Use-numbers-analogously/PARI-GP/first-class-functions-use-numbers-analogously.pari
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

10 lines
229 B
Text

multiplier(n1,n2)={
x -> n1 * n2 * x
};
test()={
my(x = 2.0, xi = 0.5, y = 4.0, yi = 0.25, z = x + y, zi = 1.0 / ( x + y ));
print(multiplier(x,xi)(0.5));
print(multiplier(y,yi)(0.5));
print(multiplier(z,zi)(0.5));
};