RosettaCodeData/Task/Function-composition/Diego/function-composition-2.diego

14 lines
382 B
Plaintext

set_namespace(rosettacode);
with_funct(f)_arg({int}, x)_ret()_calc([x] * [x]);
with_funct(g)_arg({int}, x)_ret()_calc([x] + 2);
begin_funct(compose)_arg(f, g);
[]_ret(x)_calc([f]([g]([x])));
end_funct[];
me_msg()_funct(compose)_arg(f)_funct(f)_arg(g)_funct(g)_var(x)_v(10); // result: 144
// or me_msg()_funct(compose)_arg({f}, f)_arg({g}, g)_var(x)_v(10);
reset_ns[];