[clean-list] Pattern match too lazy?

Erik Zuurbier EZuurbier@Abz.nl
Tue, 17 Dec 2002 14:13:27 +0100


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_01C2A5CE.1689A280
Content-Type: text/plain

Hi,

In Clean 1.3.2 I wrote a function like this:

fun a b=:(p,q)
	| <condition not containing p or q>	= <expression not containing
p or q>
	= <expression containing p and q>

This caused a major time leak. The solution was:

fun a b
	| <condition not containing p or q>	= <expression not containing
p or q>
	# (p,q) = b
	= <expression containing p and q>
	
Apparently in the first version the pattern match on (p,q) was strict
instead of being postponed until where it was necessary. Why is this?

Regards Erik Zuurbier

------_=_NextPart_001_01C2A5CE.1689A280
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

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



Pattern match too lazy?



Hi,

In Clean 1.3.2 I wrote a function like = this:

fun a b=3D:(p,q)
        | <condition not containing p or = q>     =3D <expression not containing p or = q>
        =3D <expression containing p and q>

This caused a major time leak. The = solution was:

fun a b
        | <condition not containing p or = q>     =3D <expression not containing p or = q>
        # (p,q) =3D b
        =3D <expression containing p and q>
       =20
Apparently in the first version the = pattern match on (p,q) was strict instead of being postponed until = where it was necessary. Why is this?

Regards Erik Zuurbier

------_=_NextPart_001_01C2A5CE.1689A280--