On Fri, Feb 27, 2009 at 3:07 PM, Oliver Mooney <[email protected]>wrote:

> Sorry, in my original code the declared variables didn't match the function
> names. I've fixed that below:
> declare  DiffListToList  DiffListFromList
>
> fun {DiffListFromList L}
>    case L
>    of Elem|nil then Hole in Elem|Hole#Hole
>
                                              ^^^^^^^^^^^^^^^
The operator '#' has higher priority than '|'!  Therefore the expression
above does not return a pair, but an ill-defined list with a pair in one of
its tails.  Try (Elem|Hole)#Hole instead.

   [] H|T then H|{DListFromList T}
>    end
> end
>

By the way, you can also define that function by reusing Append:

fun {DiffListFromList L}
   T in {Append L T}#T
end

Cheers,
raph
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to