[clean-list] Strange uniqueness

erik.zuurbier at tiscali.nl erik.zuurbier at tiscali.nl
Tue Sep 6 16:55:04 MEST 2005


Please consider the following program (see also the attachment)
Regards 
Erik Zuurbier

module FileSorter2
import StdEnv, StdIO

Start = 1

::	
*Local =	{a :: *File, d :: *File}

//	The following function has a 
uniqueness problem:

fun1 :: (PSt *Local) -> PSt *Local
fun1 pst=:
{ls=ls=:{d}}
	= {pst & ls = {ls &  a=d}}
	
//	The trouble seems to be 
that through a=d in the last line the reference to d is duplicated.
//	
We can solve this by dropping the old reference with undef:

fun2 :: 
(PSt *Local) -> PSt *Local
fun2 pst=:{ls=ls=:{d}}
	= {pst & ls = {ls &  
a=d,d=undef}}
	
//	What I do NOT understand is that it can also be 
solved by putting the {ls} and {d} patterns on separate lines:
//	Can 
someome explain? 

fun3 :: (PSt *Local) -> PSt *Local
fun3 pst=:{ls=
{d}}
	# pst=:{ls}	= pst
	= {pst & ls = {ls &  a=d}}








-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileSorter2.icl
Type: application/octet-stream
Size: 729 bytes
Desc: not available
Url : http://mailman.science.ru.nl/pipermail/clean-list/attachments/20050906/c3658430/FileSorter2.obj


More information about the clean-list mailing list