First-class functions/Use numbers analogously: Difference between revisions

Pari/GP
(Pari/GP)
Line 316:
 
"Multiplier" is like "Compose", but with multiplication instead of function application. Otherwise the code is identical except for the argument types (numbers instead of functions).
 
=={{header|PARI/GP}}==
{{works with|PARI/GP|2.4.2 and above}}
<lang>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));
};</lang>
The two are very similar, though as requested the test numbers are in 6 variables instead of two vectors.
 
=={{header|PicoLisp}}==