Partial function application: Difference between revisions
m
→{{header|Phix}}: tidy
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
m (→{{header|Phix}}: tidy) |
||
Line 1,741:
=={{header|Phix}}==
Phix does not explicitly support this, but you can easily emulate it
<lang Phix>function fs(integer rid, sequence s)
for i=1 to length(s) do
s[i] =
end for
return s
end function
function p_apply(sequence f,
integer {f1,f2} = f
return
end function
function f1(integer i)
return i+i
end function
function f2(integer i)
return i*i
end function
▲?p_apply(fsf1,{0,1,2,3})
▲?p_apply(fsf2,{2,4,6,8})</lang>
{{out}}
<pre>
Line 1,771 ⟶ 1,769:
{4,16,36,64}
</pre>
Should you want to provide the first few arguments
<lang Phix>function p_apply(sequence
return
end function</lang>
|