Hi all,
I'm having trouble with difference lists as discussed in section 3.4.4 of
CTM. I'm using the following code to covert to and from standard closed
lists and difference lists, but it fails the test at the end. The code is in
the OPI style, not functor style:
declare DiffListToList DiffListFromList
fun {DListFromList L}
case L
of Elem|nil then Hole in Elem|Hole#Hole
[] H|T then H|{DListFromList T}
end
end
fun {DiffListToList DList}
local List
in List#nil = DList
List
end
end
{Browse [1 2 3 4 5]}
{Browse {DListFromList [1 2 3 4 5]}}
{Browse {DiffListToList {DListFromList [1 2 3 4 5]}}}
The final Browse call fails with the error:
%***************************** failure **************************
%**
%** Tell: 1|2|3|4|5|_<optimized>#_<optimized> = _<optimized>#_<optimized>
%**
%** Call Stack:
%** procedure 'DiffListToList' in file "Oz", line 8, column 0, PC = 19986756
%**--------------------------------------------------------------
Why doesn't the List#nil = DList tell in the DiffListToList call succeed? I
think I'm missing something fundamental but I can't work it out!
Many thanks,
Oliver.
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users