25 lines
498 B
Plaintext
25 lines
498 B
Plaintext
function fs(integer rid, sequence s)
|
|
for i=1 to length(s) do
|
|
s[i] = call_func(rid,{s[i]})
|
|
end for
|
|
return s
|
|
end function
|
|
|
|
function p_apply(sequence f, sequence args)
|
|
return call_func(f[1],{f[2],args})
|
|
end function
|
|
|
|
function f1(integer i)
|
|
return i+i
|
|
end function
|
|
|
|
function f2(integer i)
|
|
return i*i
|
|
end function
|
|
|
|
constant fsf1 = {routine_id("fs"),routine_id("f1")},
|
|
fsf2 = {routine_id("fs"),routine_id("f2")}
|
|
|
|
?p_apply(fsf1,{0,1,2,3})
|
|
?p_apply(fsf2,{2,4,6,8})
|