Peter,
My apologies, I've no idea how I managed to miss that bug in my last
solution. The code below does actually work this time! I did have to use
three variables though, not two (one for the accumulation of the second
list, one for the reverse of the second list, and one to track the head of
the reversed list to connect the completed accumulator). Can it be done with
two?
fun {Convolute L1 L2}
fun {ConvoluteAcc L1 L2 Acc L2Reversed L2ReversedHead}
case L1 of H1|T1 then
case L2 of H2|T2 then
local H3 T3 in
H3|T3 = L2Reversed
H1#H3|{ConvoluteAcc T1 T2 H2|Acc T3 L2ReversedHead}
end
end
[] nil then
Acc = L2ReversedHead
nil
end
end
Empty1 Empty2
in
Empty1 = Empty2
{ConvoluteAcc L1 L2 nil Empty1 Empty2}
end
Thanks for your help & patience!
Oliver.
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users