[clean-list] Again: Strong root normal form

Erik Zuurbier EZuurbier@Abz.nl
Mon, 14 Oct 2002 09:25:37 +0200


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C27352.E476AB10
Content-Type: text/plain

Hi,

Below is an example of Clean 1.3.2 code that frustrates me. fun is the first
attempt. I understand (but do not appreciate) why it does not
uniqueness-typecheck. fun1 and fun2 are attempts to cure this. I don't
understand why these attempts do not work, and I would not know what would.
Hope someone can help.

Regards Erik Zuurbier

module test
import StdEnv

myArr :: {Int}
myArr = {1,2,3,4,5,6,7,8,9}

Start = fun myArr 3

fun :: {Int} Int -> (Int,{Int})
fun arr i
	# e = if (i>0) arr.[i-2] undef
	= (e,{arr & [i] = 2*e})

fun1 :: {Int} Int -> (Int,{Int})
fun1 arr i
	#! e = if (i>0) arr.[i-2] undef
	= (e,{arr & [i] = 2*e})

fun2 :: {Int} Int -> (Int,{Int})
fun2 arr i
	#! x = arr.[i-2]
	#! e = if (i>0) x undef
	= (e,{arr & [i] = 2*e})



------_=_NextPart_001_01C27352.E476AB10
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">



Again: Strong root normal form



Hi,

Below is an example of Clean 1.3.2 = code that frustrates me. fun is the first attempt. I understand (but do = not appreciate) why it does not uniqueness-typecheck. fun1 and fun2 are = attempts to cure this. I don't understand why these attempts do not = work, and I would not know what would. Hope someone can = help.

Regards Erik Zuurbier

module test
import StdEnv

myArr :: {Int}
myArr =3D {1,2,3,4,5,6,7,8,9}

Start =3D fun myArr 3

fun :: {Int} Int -> = (Int,{Int})
fun arr i
        # e =3D if (i>0) arr.[i-2] undef
        =3D (e,{arr & [i] =3D 2*e})

fun1 :: {Int} Int -> = (Int,{Int})
fun1 arr i
        #! e =3D if (i>0) arr.[i-2] undef
        =3D (e,{arr & [i] =3D 2*e})

fun2 :: {Int} Int -> = (Int,{Int})
fun2 arr i
        #! x =3D arr.[i-2]
        #! e =3D if (i>0) x undef
        =3D (e,{arr & [i] =3D 2*e})


------_=_NextPart_001_01C27352.E476AB10--