Arter scratching my head for a few days the best I can do is to use a
difference list for the second accumulator, which does reduce the number of
arguments each call but just hides the use of two variables rather than
eliminating it:
fun {Convolute L1 L2}
fun {ConvoluteAcc L1 L2 Acc RevL2} % RevL2 is a difference list
case L1#L2#RevL2 of (H1|T1)#(H2|T2)#(L#End) then
local H3 NewEnd in
End = H3|NewEnd
H1#H3|{ConvoluteAcc T1 T2 H2|Acc (L)#NewEnd}
end
[] nil#nil#(L#End) then
End = nil
L = Acc
nil
end
end
Empty
in
{ConvoluteAcc L1 L2 nil (Empty)#Empty}
end
If that's not the optimal solution, could I have another hint please??
Many thanks,
Oliver.
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users