[mercury-users] Self-referential data structures

Peter Schachte pets at students.cs.mu.oz.au
Fri Dec 5 10:51:54 AEDT 1997


On Mon, 1 Dec 1997, Fergus Henderson wrote:

> I have just thought of another solution.  We could provide a new
> procedure in the `store' module to create a circular element. 
> This procedure would take as an argument a function which when
> given a reference (mutvar) to type T produces a value of type T.

Could you give us a quick example of how this could be used?

...
> This avoids the need for null references (and hence the need to
> document for every procedure taking a reference what happens if
> the reference is null).  It avoids the need to use a maybe(T) type.

How?  In many uses of circular structures, there's still the need for
empty structures.  How can you handle these without some use of a
maybe type, or making everything semidet/nondet?


-Peter Schachte			| Patriotism is the last refuge of a
pets at cs.mu.OZ.AU		| scoundrel. -- Samuel Johnson, 7 Apr. 1775 
http://www.cs.mu.oz.au/~pets/	| 
PGP key available on request	| 




More information about the users mailing list