Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
9
Task/Filter/Phix/filter-1.phix
Normal file
9
Task/Filter/Phix/filter-1.phix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function filternd(sequence array, integer filterid)
|
||||
sequence res = {}
|
||||
for i=1 to length(array) do
|
||||
if call_func(filterid,{array[i]}) then
|
||||
res = append(res,array[i])
|
||||
end if
|
||||
end for
|
||||
return res
|
||||
end function
|
||||
26
Task/Filter/Phix/filter-2.phix
Normal file
26
Task/Filter/Phix/filter-2.phix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
function filterd(sequence a, integer filterid)
|
||||
integer l = 0
|
||||
for i=1 to length(a) do
|
||||
if call_func(filterid,{a[i]}) then
|
||||
l += 1
|
||||
a[l] = a[i]
|
||||
end if
|
||||
end for
|
||||
return a[1..l]
|
||||
end function
|
||||
|
||||
function even(integer i)
|
||||
return and_bits(i,1)=0
|
||||
end function
|
||||
constant r_even = routine_id("even")
|
||||
|
||||
procedure main()
|
||||
sequence s = tagset(10), t
|
||||
t = filterd(s,r_even)
|
||||
?s
|
||||
?t
|
||||
-- automatic pass by reference occurs here for s:
|
||||
s = filterd(s,r_even)
|
||||
?s
|
||||
end procedure
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue