Peter,
Thanks for pointing me in the right direction - I've derived a working
solution but it looks a bit ungainly to me. I unrolled one iteration of the
function to get the reversed list started and then had to short-circuit the
final recursion on the far end to account for the list being reversed
starting out one element shorter. Does that technically mean that I'm
recursing n-1 times, so it isn't the envisaged solution?
fun {Convolute L1 L2}
fun {ConvoluteAcc L1 L2 Acc}
case L1 of H1|T1 then
case L2 of H2|T2 then
local H3 in
H3|_ = Acc
H1#H3|{ConvoluteAcc T1 T2 H2|Acc}
end
[] nil then
local H3 in
H3|_ = Acc
H1#H3|nil
end
end
end
end
Elem
in
case L2 of H|T then
{ConvoluteAcc L1 T H|Elem}
end
end
Besides that, thank you & your co-authors for CTM, I'm enjoying working
through it very much, particularly the exposure to the less well known
execution models.
Oliver.
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users