Problem with array updates
Martin Wierich
martinw@cs.kun.nl
Mon, 21 Feb 2000 10:34:41 +0100
Hi Pablo,
"Pablo J. Pedemonte" wrote:
> I can't mark the array as unique, for I would force the whole VEBTree type
> to be unique. In this case, I can't use the function createArray (not even an
> array comprehension) to initialize it, for they seem to need a non unique elem
> as parameter (I am right?). I get the following error message:
>
> "createArray ({})" attribute at the indicated position cannot be coerced: ^ VEBTree Int
I think the only way to create an array that contains unique objects is to convert a list
into an array. Therefore use an array comprehension:
:: VEBTree u
= EmptyVEB u
| ManyVEB u .{VEBTree u} (VEBTree u)
initialize i u
= ManyVEB u { EmptyVEB u \\ u <- (repeatn i u)} (EmptyVEB u)
update_destructively (ManyVEB u array subtree)
= ManyVEB u { array & [0] = EmptyVEB 100 } subtree
Start = (initialize 2 0, update_destructively (initialize 2 0))
greetings
Martin Wierich