[pure-lang-svn] SF.net SVN: pure-lang: [140] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-05-27 04:45:59
|
Revision: 140 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=140&view=rev Author: agraef Date: 2008-05-26 21:46:07 -0700 (Mon, 26 May 2008) Log Message: ----------- Revert previous changes which are not needed any more because && and || are now tail-recursive. Modified Paths: -------------- pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-27 04:32:49 UTC (rev 139) +++ pure/trunk/lib/prelude.pure 2008-05-27 04:46:07 UTC (rev 140) @@ -92,12 +92,12 @@ ()==() = 1; (x,xs)==() = 0; ()==(x,xs) = 0; -(x,xs)==(y,ys) = if x==y then xs==ys else 0; +(x,xs)==(y,ys) = x==y && xs==ys; ()!=() = 0; (x,xs)!=() = 1; ()!=(x,xs) = 1; -(x,xs)!=(y,ys) = if x!=y then 1 else xs!=ys; +(x,xs)!=(y,ys) = x!=y || xs!=ys; null () = 1; null (x,xs) = 0; @@ -133,12 +133,12 @@ []==[] = 1; (x:xs)==[] = 0; []==(x:xs) = 0; -(x:xs)==(y:ys) = if x==y then xs==ys else 1; +(x:xs)==(y:ys) = x==y && xs==ys; []!=[] = 0; (x:xs)!=[] = 1; []!=(x:xs) = 1; -(x:xs)!=(y:ys) = if x!=y then 1 else xs!=ys; +(x:xs)!=(y:ys) = x!=y || xs!=ys; null [] = 1; null (x:xs) = 0; @@ -207,10 +207,10 @@ functions have slightly different names). */ all p [] = 1; -all p (x:xs) = if p x then all p xs else 0; +all p (x:xs) = p x && all p xs; any p [] = 0; -any p (x:xs) = if p x then 1 else any p xs; +any p (x:xs) = p x || any p xs; do f [] = (); do f (x:xs) = do f xs when _ = f x end; Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-27 04:32:49 UTC (rev 139) +++ pure/trunk/test/prelude.log 2008-05-27 04:46:07 UTC (rev 140) @@ -334,11 +334,11 @@ ()==() = 1; (x/*0:0101*/,xs/*0:011*/)==() = 0; ()==(x/*0:101*/,xs/*0:11*/) = 0; -(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = if x/*0:0101*/==y/*0:101*/ then xs/*0:011*/==ys/*0:11*/ else 0; +(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; ()!=() = 0; (x/*0:0101*/,xs/*0:011*/)!=() = 1; ()!=(x/*0:101*/,xs/*0:11*/) = 1; -(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = if x/*0:0101*/!=y/*0:101*/ then 1 else xs/*0:011*/!=ys/*0:11*/; +(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; null () = 1; null (x/*0:101*/,xs/*0:11*/) = 0; #() = 0; @@ -407,11 +407,11 @@ []==[] = 1; x/*0:0101*/:xs/*0:011*/==[] = 0; []==x/*0:101*/:xs/*0:11*/ = 0; -x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = if x/*0:0101*/==y/*0:101*/ then xs/*0:011*/==ys/*0:11*/ else 1; +x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; []!=[] = 0; x/*0:0101*/:xs/*0:011*/!=[] = 1; []!=x/*0:101*/:xs/*0:11*/ = 1; -x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = if x/*0:0101*/!=y/*0:101*/ then 1 else xs/*0:011*/!=ys/*0:11*/; +x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; null [] = 1; null (x/*0:101*/:xs/*0:11*/) = 0; #[] = 0; @@ -629,9 +629,9 @@ state 1: #0 }) n/*0:01*/; all p/*0:01*/ [] = 1; -all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = if p/*0:01*/ x/*0:101*/ then all p/*0:01*/ xs/*0:11*/ else 0; +all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/&&all p/*0:01*/ xs/*0:11*/; any p/*0:01*/ [] = 0; -any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = if p/*0:01*/ x/*0:101*/ then 1 else any p/*0:01*/ xs/*0:11*/; +any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/||any p/*0:01*/ xs/*0:11*/; do f/*0:01*/ [] = (); do f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = do f/*1:01*/ xs/*1:11*/ when _/*0:*/ = f/*0:01*/ x/*0:101*/ { rule #0: _ = f x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |