Thread: [pure-lang-svn] SF.net SVN: pure-lang: [66] pure/trunk/test/prelude.log
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-05-06 17:49:44
|
Revision: 66 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=66&view=rev Author: agraef Date: 2008-05-06 10:49:50 -0700 (Tue, 06 May 2008) Log Message: ----------- Update test log (added pow, sqrt and ^ definitions). Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-06 17:45:54 UTC (rev 65) +++ pure/trunk/test/prelude.log 2008-05-06 17:49:50 UTC (rev 66) @@ -189,9 +189,27 @@ x/*0:01*/::double>=y/*0:1*/::bigint = x/*0:01*/>=double y/*0:1*/; x/*0:01*/::double==y/*0:1*/::bigint = x/*0:01*/==double y/*0:1*/; x/*0:01*/::double!=y/*0:1*/::bigint = x/*0:01*/!=double y/*0:1*/; -pow x/*0:01*/::bigint y/*0:1*/::int = bigint_pow x/*0:01*/ y/*0:1*/ if y/*0:1*/>=0; +sqrt x/*0:1*/::int = c_sqrt (double x/*0:1*/) if x/*0:1*/>=0; +sqrt x/*0:1*/::bigint = c_sqrt (double x/*0:1*/) if x/*0:1*/>=0; +sqrt x/*0:1*/::double = c_sqrt x/*0:1*/ if x/*0:1*/>=0; pow x/*0:01*/::int y/*0:1*/::int = bigint_pow (bigint x/*0:01*/) y/*0:1*/ if y/*0:1*/>=0; pow x/*0:01*/::bigint y/*0:1*/::bigint = bigint_pow x/*0:01*/ (int y/*0:1*/) if int y/*0:1*/>=0; +pow x/*0:01*/::double y/*0:1*/::double = c_pow x/*0:01*/ y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; +pow x/*0:01*/::int y/*0:1*/::bigint = bigint_pow (bigint x/*0:01*/) (int y/*0:1*/) if y/*0:1*/>=0; +pow x/*0:01*/::bigint y/*0:1*/::int = bigint_pow x/*0:01*/ y/*0:1*/ if y/*0:1*/>=0; +pow x/*0:01*/::double y/*0:1*/::int = c_pow x/*0:01*/ (double y/*0:1*/); +pow x/*0:01*/::double y/*0:1*/::bigint = c_pow x/*0:01*/ (double y/*0:1*/); +pow x/*0:01*/::int y/*0:1*/::double = c_pow (double x/*0:01*/) y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; +pow x/*0:01*/::bigint y/*0:1*/::double = c_pow (double x/*0:01*/) y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; +x/*0:01*/::double^y/*0:1*/::double = c_pow x/*0:01*/ y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; +x/*0:01*/::int^y/*0:1*/::int = c_pow (double x/*0:01*/) (double y/*0:1*/); +x/*0:01*/::bigint^y/*0:1*/::bigint = c_pow (double x/*0:01*/) (double y/*0:1*/); +x/*0:01*/::int^y/*0:1*/::bigint = c_pow (double x/*0:01*/) (double y/*0:1*/); +x/*0:01*/::bigint^y/*0:1*/::int = c_pow (double x/*0:01*/) (double y/*0:1*/); +x/*0:01*/::double^y/*0:1*/::int = c_pow x/*0:01*/ (double y/*0:1*/); +x/*0:01*/::double^y/*0:1*/::bigint = c_pow x/*0:01*/ (double y/*0:1*/); +x/*0:01*/::int^y/*0:1*/::double = c_pow (double x/*0:01*/) y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; +x/*0:01*/::bigint^y/*0:1*/::double = c_pow (double x/*0:01*/) y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; null x/*0:1*/ = bigint x/*0:1*/==0; x/*0:01*/-y/*0:1*/ = bigint x/*0:01*/-bigint y/*0:1*/; x/*0:01*/+y/*0:1*/::int = pointer (bigint x/*0:01*/+y/*0:1*/); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-25 07:02:32
|
Revision: 132 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=132&view=rev Author: agraef Date: 2008-05-25 00:02:37 -0700 (Sun, 25 May 2008) Log Message: ----------- Update test logs. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-25 07:00:36 UTC (rev 131) +++ pure/trunk/test/prelude.log 2008-05-25 07:02:37 UTC (rev 132) @@ -428,9 +428,9 @@ state 1: #0 }) n/*0:01*/; all p/*0:01*/ [] = 1; -all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/&&all p/*0:01*/ xs/*0:11*/; +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; any p/*0:01*/ [] = 0; -any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/||any p/*0:01*/ xs/*0:11*/; +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*/; 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. |
From: <ag...@us...> - 2008-05-27 09:18:42
|
Revision: 143 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=143&view=rev Author: agraef Date: 2008-05-27 02:18:50 -0700 (Tue, 27 May 2008) Log Message: ----------- Overhaul of prelude. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-27 09:17:56 UTC (rev 142) +++ pure/trunk/test/prelude.log 2008-05-27 09:18:50 UTC (rev 143) @@ -1,4 +1,5 @@ throw x/*0:1*/ = pure_throw x/*0:1*/; +assert p/*0:01*/ e/*0:1*/ = if p/*0:01*/ then 1 else throw e/*0:1*/; x/*0:01*/===y/*0:1*/ = same x/*0:01*/ y/*0:1*/; x/*0:01*/!==y/*0:1*/ = not same x/*0:01*/ y/*0:1*/; intp x/*0:1*/ = case x/*0:1*/ of _/*0:*/::int = 1; _/*0:*/ = 0 { @@ -49,6 +50,9 @@ listp [] = 1; listp (x/*0:101*/:xs/*0:11*/) = listp xs/*0:11*/; listp _/*0:1*/ = 0; +listnp [] = 1; +listnp (x/*0:101*/:xs/*0:11*/) = 1; +listnp _/*0:1*/ = 0; tuplep () = 1; tuplep (x/*0:101*/,xs/*0:11*/) = 1; tuplep _/*0:1*/ = 0; @@ -374,6 +378,7 @@ (x/*0:0101*/,xs/*0:011*/)!0 = x/*0:0101*/; (x/*0:0101*/,y/*0:01101*/,xs/*0:0111*/)!n/*0:1*/::int = (y/*0:01101*/,xs/*0:0111*/)!(n/*0:1*/-1) if n/*0:1*/>0; (x/*0:0101*/,y/*0:011*/)!1 = y/*0:011*/; +(x/*0:0101*/,xs/*0:011*/)!n/*0:1*/::int = throw out_of_bounds; reverse () = (); reverse (x/*0:101*/,xs/*0:11*/) = accum/*0*/ x/*0:101*/ xs/*0:11*/ with accum ys/*0:01*/ (x/*0:101*/,xs/*0:11*/) = accum/*1*/ (x/*0:101*/,ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ x/*0:1*/ = x/*0:1*/,ys/*0:01*/ { rule #0: accum ys (x,xs) = accum (x,ys) xs @@ -452,7 +457,9 @@ state 15: #1 #2 } end; (x/*0:0101*/:xs/*0:011*/)!0 = x/*0:0101*/; -(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = xs/*0:011*/!(n/*0:1*/-1) if n/*0:1*/>0; +(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = xs/*0:011*/!(n/*0:1*/-1) if n/*0:1*/>0&&assert (listnp xs/*0:011*/) (bad_list_value xs/*0:011*/); +(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = throw out_of_bounds; +[]!n/*0:1*/::int = throw out_of_bounds; []+ys/*0:1*/ = ys/*0:1*/; (x/*0:0101*/:xs/*0:011*/)+ys/*0:1*/ = x/*0:0101*/:accum/*0*/ ys/*0:1*/ (reverse xs/*0:011*/) with accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ [] = ys/*0:01*/ { rule #0: accum ys (x:xs) = accum (x:ys) xs @@ -570,31 +577,35 @@ state 13: #1 #2 } end; xs/*0:01*/![] = []; -xs/*0:01*/!(n/*0:101*/:ns/*0:11*/) = accum/*0*/ [] xs/*0:01*/ (reverse (n/*0:101*/:ns/*0:11*/)) (#xs/*0:01*/) with accum ys/*0:0001*/ xs/*0:001*/ [] m/*0:1*/ = ys/*0:0001*/; accum ys/*0:0001*/ xs/*0:001*/ (n/*0:0101*/::int:ns/*0:011*/) m/*0:1*/ = accum/*1*/ (xs/*0:001*/!n/*0:0101*/:ys/*0:0001*/) xs/*0:001*/ ns/*0:011*/ m/*0:1*/ if n/*0:0101*/>=0&&n/*0:0101*/<m/*0:1*/; accum ys/*0:0001*/ xs/*0:001*/ (n/*0:0101*/::int:ns/*0:011*/) m/*0:1*/ = accum/*1*/ ys/*0:0001*/ xs/*0:001*/ ns/*0:011*/ m/*0:1*/ { - rule #0: accum ys xs [] m = ys - rule #1: accum ys xs (n::int:ns) m = accum (xs!n:ys) xs ns m if n>=0&&n<m - rule #2: accum ys xs (n::int:ns) m = accum ys xs ns m - state 0: #0 #1 #2 +xs/*0:01*/!(n/*0:101*/:ns/*0:11*/) = accum/*0*/ [] (reverse (n/*1:101*/:ns/*1:11*/)) with accum ys/*0:01*/ [] = ys/*0:01*/; accum ys/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = accum/*1*/ (xs/*2:01*/!n/*0:101*/:ys/*0:01*/) ns/*0:11*/ if n/*0:101*/>=0&&n/*0:101*/<m/*1:*/; accum ys/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = accum/*1*/ ys/*0:01*/ ns/*0:11*/; accum _/*0:01*/ (n/*0:101*/:_/*0:11*/) = throw (bad_value n/*0:101*/) { + rule #0: accum ys [] = ys + rule #1: accum ys (n::int:ns) = accum (xs!n:ys) ns if n>=0&&n<m + rule #2: accum ys (n::int:ns) = accum ys ns + rule #3: accum _ (n:_) = throw (bad_value n) + state 0: #0 #1 #2 #3 <var> state 1 - state 1: #0 #1 #2 - <var> state 2 - state 2: #0 #1 #2 - [] state 3 - <app> state 5 - state 3: #0 - <var> state 4 - state 4: #0 - state 5: #1 #2 - <app> state 6 - state 6: #1 #2 - : state 7 - state 7: #1 #2 + state 1: #0 #1 #2 #3 + [] state 2 + <app> state 3 + state 2: #0 + state 3: #1 #2 #3 + <app> state 4 + state 4: #1 #2 #3 + : state 5 + state 5: #1 #2 #3 + <var> state 6 <var>::int state 8 - state 8: #1 #2 + state 6: #3 + <var> state 7 + state 7: #3 + state 8: #1 #2 #3 <var> state 9 - state 9: #1 #2 - <var> state 10 - state 10: #1 #2 + state 9: #1 #2 #3 +} end when m/*0:*/::int = #xs/*0:01*/ { + rule #0: m::int = #xs + state 0: #0 + <var>::int state 1 + state 1: #0 } end; n1/*0:0101*/,n2/*0:011*/..m/*0:1*/ = while (\i/*0:*/ -> s/*1:*/*i/*0:*/<=s/*1:*/*m/*3:1*/ { rule #0: i = s*i<=s*m @@ -652,9 +663,9 @@ foldl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldl f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; foldl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldl f/*0:01*/ x/*0:101*/ xs/*0:11*/; foldr f/*0:001*/ a/*0:01*/ [] = a/*0:01*/; -foldr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:001*/ x/*0:101*/ (foldr f/*0:001*/ a/*0:01*/ xs/*0:11*/); +foldr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:001*/ x/*0:101*/ (foldl (flip f/*0:001*/) a/*0:01*/ (reverse xs/*0:11*/)); foldr1 f/*0:01*/ [x/*0:101*/] = x/*0:101*/; -foldr1 f/*0:01*/ (x/*0:101*/:y/*0:1101*/:xs/*0:111*/) = f/*0:01*/ x/*0:101*/ (foldr1 f/*0:01*/ (y/*0:1101*/:xs/*0:111*/)); +foldr1 f/*0:01*/ (x/*0:101*/:y/*0:1101*/:xs/*0:111*/) = f/*0:01*/ x/*0:101*/ (foldl1 (flip f/*0:01*/) (reverse (y/*0:1101*/:xs/*0:111*/))); head (x/*0:101*/:xs/*0:11*/) = x/*0:101*/; init [x/*0:101*/] = []; init (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:init xs/*0:11*/; @@ -663,11 +674,46 @@ map f/*0:01*/ [] = []; map f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:01*/ x/*0:101*/:map f/*0:01*/ xs/*0:11*/; scanl f/*0:001*/ a/*0:01*/ [] = [a/*0:01*/]; -scanl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = a/*0:01*/:scanl f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; +scanl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [a/*0:01*/] f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/ with accum ys/*0:0001*/ f/*0:001*/ a/*0:01*/ [] = reverse (a/*0:01*/:ys/*0:0001*/); accum ys/*0:0001*/ f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (a/*0:01*/:ys/*0:0001*/) f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; accum _/*0:0001*/ _/*0:001*/ _/*0:01*/ xs/*0:1*/ = throw (bad_list_value xs/*0:1*/) { + rule #0: accum ys f a [] = reverse (a:ys) + rule #1: accum ys f a (x:xs) = accum (a:ys) f (f a x) xs + rule #2: accum _ _ _ xs = throw (bad_list_value xs) + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + state 2: #0 #1 #2 + <var> state 3 + state 3: #0 #1 #2 + <var> state 4 + [] state 5 + <app> state 6 + state 4: #2 + state 5: #0 #2 + state 6: #1 #2 + <var> state 7 + <app> state 9 + state 7: #2 + <var> state 8 + state 8: #2 + state 9: #1 #2 + <var> state 10 + : state 13 + state 10: #2 + <var> state 11 + state 11: #2 + <var> state 12 + state 12: #2 + state 13: #1 #2 + <var> state 14 + state 14: #1 #2 + <var> state 15 + state 15: #1 #2 +} end; scanl1 f/*0:01*/ [] = []; scanl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = scanl f/*0:01*/ x/*0:101*/ xs/*0:11*/; scanr f/*0:001*/ a/*0:01*/ [] = [a/*0:01*/]; -scanr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:001*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = scanr f/*0:001*/ a/*0:01*/ xs/*0:11*/; y/*0:01*/:_/*0:1*/ = ys/*0:*/ { +scanr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:001*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = reverse (scanl (flip f/*0:001*/) a/*0:01*/ (reverse xs/*0:11*/)); y/*0:01*/:_/*0:1*/ = ys/*0:*/ { rule #0: y:_ = ys state 0: #0 <app> state 1 @@ -681,14 +727,14 @@ <var> state 5 state 5: #0 } { - rule #0: ys = scanr f a xs + rule #0: ys = reverse (scanl (flip f) a (reverse xs)) state 0: #0 <var> state 1 state 1: #0 } end; scanr1 f/*0:01*/ [] = []; scanr1 f/*0:01*/ [x/*0:101*/] = [x/*0:101*/]; -scanr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:01*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = scanr1 f/*0:01*/ xs/*0:11*/; y/*0:01*/:_/*0:1*/ = ys/*0:*/ { +scanr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:01*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = reverse (scanl1 (flip f/*0:01*/) (reverse xs/*0:11*/)); y/*0:01*/:_/*0:1*/ = ys/*0:*/ { rule #0: y:_ = ys state 0: #0 <app> state 1 @@ -702,7 +748,7 @@ <var> state 5 state 5: #0 } { - rule #0: ys = scanr1 f xs + rule #0: ys = reverse (scanl1 (flip f) (reverse xs)) state 0: #0 <var> state 1 state 1: #0 @@ -715,6 +761,7 @@ takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:takewhile p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = []; cat [] = []; +cat [xs/*0:101*/] = xs/*0:101*/; cat (xs/*0:101*/:xss/*0:11*/) = accum/*0*/ (reverse xs/*0:101*/) xss/*0:11*/ with accum xs/*0:01*/ [] = reverse xs/*0:01*/; accum xs/*0:01*/ ([]:yss/*0:11*/) = accum/*1*/ xs/*0:01*/ yss/*0:11*/; accum xs/*0:01*/ ((y/*0:10101*/:ys/*0:1011*/):yss/*0:11*/) = accum/*1*/ (y/*0:10101*/:xs/*0:01*/) (ys/*0:1011*/:yss/*0:11*/); accum _/*0:01*/ (ys/*0:101*/:_/*0:11*/) = throw (bad_list_value ys/*0:101*/); accum _/*0:01*/ yss/*0:1*/ = throw (bad_list_value yss/*0:1*/) { rule #0: accum xs [] = reverse xs rule #1: accum xs ([]:yss) = accum xs yss This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-28 03:41:03
|
Revision: 148 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=148&view=rev Author: agraef Date: 2008-05-27 20:41:08 -0700 (Tue, 27 May 2008) Log Message: ----------- Overhaul of prelude. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-05-28 03:40:55 UTC (rev 147) +++ pure/trunk/test/prelude.log 2008-05-28 03:41:08 UTC (rev 148) @@ -295,6 +295,22 @@ } end if not null delim/*0:01*/; reverse s/*0:1*/::string = strcat (reverse (chars s/*0:1*/)); cat (s/*0:101*/::string:xs/*0:11*/) = cat (chars s/*0:101*/:xs/*0:11*/); +cycle n/*0:01*/::int "" = ""; +cycle n/*0:01*/::int s/*0:1*/::string = "" if n/*0:01*/<=0; +cycle n/*0:01*/::int s/*0:1*/::string = accum/*0*/ [] n/*1:01*/ with accum ys/*0:01*/ n/*0:1*/ = strcat ys/*0:01*/+take n/*0:1*/ s/*2:1*/ if n/*0:1*/<=m/*1:*/; accum ys/*0:01*/ n/*0:1*/ = accum/*1*/ (s/*2:1*/:ys/*0:01*/) (n/*0:1*/-m/*1:*/) { + rule #0: accum ys n = strcat ys+take n s if n<=m + rule #1: accum ys n = accum (s:ys) (n-m) + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + state 2: #0 #1 +} end when m/*0:*/::int = #s/*0:1*/ { + rule #0: m::int = #s + state 0: #0 + <var>::int state 1 + state 1: #0 +} end; all p/*0:01*/ s/*0:1*/::string = all p/*0:01*/ (chars s/*0:1*/); any p/*0:01*/ s/*0:1*/::string = any p/*0:01*/ (chars s/*0:1*/); do f/*0:01*/ s/*0:1*/::string = do f/*0:01*/ (chars s/*0:1*/); @@ -1033,6 +1049,46 @@ state 28: #2 #3 #4 } end; catmap f/*0:01*/ xs/*0:1*/ = cat (map f/*0:01*/ xs/*0:1*/); +index [] _/*0:1*/ = -1; +index (x/*0:0101*/:xs/*0:011*/) y/*0:1*/ = search/*0*/ 0 (x/*0:0101*/:xs/*0:011*/) with search _/*0:01*/ [] = -1; search n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = n/*0:01*/ if x/*0:101*/==y/*1:1*/; search n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = search/*1*/ (n/*0:01*/+1) xs/*0:11*/; search _/*0:01*/ xs/*0:1*/ = index xs/*0:1*/ y/*1:1*/ { + rule #0: search _ [] = -1 + rule #1: search n::int (x:xs) = n if x==y + rule #2: search n::int (x:xs) = search (n+1) xs + rule #3: search _ xs = index xs y + state 0: #0 #1 #2 #3 + <var> state 1 + <var>::int state 4 + state 1: #0 #3 + <var> state 2 + [] state 3 + state 2: #3 + state 3: #0 #3 + state 4: #0 #1 #2 #3 + <var> state 5 + [] state 6 + <app> state 7 + state 5: #3 + state 6: #0 #3 + state 7: #1 #2 #3 + <var> state 8 + <app> state 10 + state 8: #3 + <var> state 9 + state 9: #3 + state 10: #1 #2 #3 + <var> state 11 + : state 14 + state 11: #3 + <var> state 12 + state 12: #3 + <var> state 13 + state 13: #3 + state 14: #1 #2 #3 + <var> state 15 + state 15: #1 #2 #3 + <var> state 16 + state 16: #1 #2 #3 +} end; repeat n/*0:01*/::int x/*0:1*/ = accum/*0*/ [] n/*0:01*/ x/*0:1*/ with accum xs/*0:001*/ n/*0:01*/::int x/*0:1*/ = xs/*0:001*/ if n/*0:01*/<=0; accum xs/*0:001*/ n/*0:01*/::int x/*0:1*/ = accum/*1*/ (x/*0:1*/:xs/*0:001*/) (n/*0:01*/-1) x/*0:1*/ { rule #0: accum xs n::int x = xs if n<=0 rule #1: accum xs n::int x = accum (x:xs) (n-1) x @@ -1046,24 +1102,25 @@ } end; cycle n/*0:01*/::int [] = []; cycle n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = [] if n/*0:01*/<=0; -cycle n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [] (#xs/*0:*/) n/*1:01*/ xs/*0:*/ with accum ys/*0:0001*/ m/*0:001*/::int n/*0:01*/::int xs/*0:1*/ = cat ys/*0:0001*/+take n/*0:01*/ xs/*0:1*/ if n/*0:01*/<=m/*0:001*/; accum ys/*0:0001*/ m/*0:001*/::int n/*0:01*/::int xs/*0:1*/ = accum/*1*/ (xs/*0:1*/:ys/*0:0001*/) m/*0:001*/ (n/*0:01*/-m/*0:001*/) xs/*0:1*/ { - rule #0: accum ys m::int n::int xs = cat ys+take n xs if n<=m - rule #1: accum ys m::int n::int xs = accum (xs:ys) m (n-m) xs +cycle n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [] n/*2:01*/ with accum ys/*0:01*/ n/*0:1*/::int = cat ys/*0:01*/+take n/*0:1*/ xs/*2:*/ if n/*0:1*/<=m/*1:*/; accum ys/*0:01*/ n/*0:1*/::int = accum/*1*/ (xs/*2:*/:ys/*0:01*/) (n/*0:1*/-m/*1:*/) { + rule #0: accum ys n::int = cat ys+take n xs if n<=m + rule #1: accum ys n::int = accum (xs:ys) (n-m) state 0: #0 #1 <var> state 1 state 1: #0 #1 <var>::int state 2 state 2: #0 #1 - <var>::int state 3 - state 3: #0 #1 - <var> state 4 - state 4: #0 #1 -} end when xs/*0:*/ = x/*0:101*/:xs/*0:11*/ { +} end when xs/*0:*/ = x/*0:101*/:xs/*0:11*/; m/*0:*/::int = #xs/*0:*/ { + rule #0: m::int = #xs + state 0: #0 + <var>::int state 1 + state 1: #0 +} { rule #0: xs = x:xs state 0: #0 <var> state 1 state 1: #0 -} end; +} end if listp xs/*0:11*/; while p/*0:001*/ f/*0:01*/ a/*0:1*/ = accum/*0*/ [] p/*0:001*/ f/*0:01*/ a/*0:1*/ with accum as/*0:0001*/ p/*0:001*/ f/*0:01*/ a/*0:1*/ = accum/*1*/ (a/*0:1*/:as/*0:0001*/) p/*0:001*/ f/*0:01*/ (f/*0:01*/ a/*0:1*/) if p/*0:001*/ a/*0:1*/; accum as/*0:0001*/ p/*0:001*/ f/*0:01*/ a/*0:1*/ = reverse as/*0:0001*/ { rule #0: accum as p f a = accum (a:as) p f (f a) if p a rule #1: accum as p f a = reverse as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-18 07:25:11
|
Revision: 253 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=253&view=rev Author: agraef Date: 2008-06-18 00:25:20 -0700 (Wed, 18 Jun 2008) Log Message: ----------- Rename '|' -> 'or', '&' -> 'and'. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-06-18 07:24:07 UTC (rev 252) +++ pure/trunk/test/prelude.log 2008-06-18 07:25:20 UTC (rev 253) @@ -79,12 +79,12 @@ x/*0:01*/::int>>y/*0:1*/::int = x/*0:01*/>>y/*0:1*/; x/*0:01*/::int+y/*0:1*/::int = x/*0:01*/+y/*0:1*/; x/*0:01*/::int-y/*0:1*/::int = x/*0:01*/-y/*0:1*/; -x/*0:01*/::int|y/*0:1*/::int = x/*0:01*/|y/*0:1*/; x/*0:01*/::int*y/*0:1*/::int = x/*0:01*/*y/*0:1*/; x/*0:01*/::int/y/*0:1*/::int = x/*0:01*//y/*0:1*/; -x/*0:01*/::int&y/*0:1*/::int = x/*0:01*/&y/*0:1*/; x/*0:01*/::int div y/*0:1*/::int = x/*0:01*/ div y/*0:1*/; x/*0:01*/::int mod y/*0:1*/::int = x/*0:01*/ mod y/*0:1*/; +x/*0:01*/::int or y/*0:1*/::int = x/*0:01*/ or y/*0:1*/; +x/*0:01*/::int and y/*0:1*/::int = x/*0:01*/ and y/*0:1*/; x/*0:01*/::int<y/*0:1*/::int = x/*0:01*/<y/*0:1*/; x/*0:01*/::int>y/*0:1*/::int = x/*0:01*/>y/*0:1*/; x/*0:01*/::int<=y/*0:1*/::int = x/*0:01*/<=y/*0:1*/; @@ -133,12 +133,12 @@ x/*0:01*/::bigint>>y/*0:1*/::int = bigint_shl x/*0:01*/ (-y/*0:1*/); x/*0:01*/::bigint+y/*0:1*/::bigint = bigint_add x/*0:01*/ y/*0:1*/; x/*0:01*/::bigint-y/*0:1*/::bigint = bigint_sub x/*0:01*/ y/*0:1*/; -x/*0:01*/::bigint|y/*0:1*/::bigint = bigint_or x/*0:01*/ y/*0:1*/; x/*0:01*/::bigint*y/*0:1*/::bigint = bigint_mul x/*0:01*/ y/*0:1*/; x/*0:01*/::bigint/y/*0:1*/::bigint = double x/*0:01*//double y/*0:1*/; -x/*0:01*/::bigint&y/*0:1*/::bigint = bigint_and x/*0:01*/ y/*0:1*/; x/*0:01*/::bigint div y/*0:1*/::bigint = bigint_div x/*0:01*/ y/*0:1*/; x/*0:01*/::bigint mod y/*0:1*/::bigint = bigint_mod x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint or y/*0:1*/::bigint = bigint_or x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint and y/*0:1*/::bigint = bigint_and x/*0:01*/ y/*0:1*/; x/*0:01*/::bigint<y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/<0; x/*0:01*/::bigint>y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/>0; x/*0:01*/::bigint<=y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/<=0; @@ -147,12 +147,12 @@ x/*0:01*/::bigint!=y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/!=0; x/*0:01*/::int+y/*0:1*/::bigint = bigint x/*0:01*/+y/*0:1*/; x/*0:01*/::int-y/*0:1*/::bigint = bigint x/*0:01*/-y/*0:1*/; -x/*0:01*/::int|y/*0:1*/::bigint = bigint x/*0:01*/|y/*0:1*/; x/*0:01*/::int*y/*0:1*/::bigint = bigint x/*0:01*/*y/*0:1*/; x/*0:01*/::int/y/*0:1*/::bigint = double x/*0:01*//y/*0:1*/; -x/*0:01*/::int&y/*0:1*/::bigint = bigint x/*0:01*/&y/*0:1*/; x/*0:01*/::int div y/*0:1*/::bigint = bigint x/*0:01*/ div y/*0:1*/; x/*0:01*/::int mod y/*0:1*/::bigint = bigint x/*0:01*/ mod y/*0:1*/; +x/*0:01*/::int or y/*0:1*/::bigint = bigint x/*0:01*/ or y/*0:1*/; +x/*0:01*/::int and y/*0:1*/::bigint = bigint x/*0:01*/ and y/*0:1*/; x/*0:01*/::int<y/*0:1*/::bigint = bigint x/*0:01*/<y/*0:1*/; x/*0:01*/::int>y/*0:1*/::bigint = bigint x/*0:01*/>y/*0:1*/; x/*0:01*/::int<=y/*0:1*/::bigint = bigint x/*0:01*/<=y/*0:1*/; @@ -161,12 +161,12 @@ x/*0:01*/::int!=y/*0:1*/::bigint = bigint x/*0:01*/!=y/*0:1*/; x/*0:01*/::bigint+y/*0:1*/::int = x/*0:01*/+bigint y/*0:1*/; x/*0:01*/::bigint-y/*0:1*/::int = x/*0:01*/-bigint y/*0:1*/; -x/*0:01*/::bigint|y/*0:1*/::int = x/*0:01*/|bigint y/*0:1*/; x/*0:01*/::bigint*y/*0:1*/::int = x/*0:01*/*bigint y/*0:1*/; x/*0:01*/::bigint/y/*0:1*/::int = x/*0:01*//double y/*0:1*/; -x/*0:01*/::bigint&y/*0:1*/::int = x/*0:01*/&bigint y/*0:1*/; x/*0:01*/::bigint div y/*0:1*/::int = x/*0:01*/ div bigint y/*0:1*/; x/*0:01*/::bigint mod y/*0:1*/::int = x/*0:01*/ mod bigint y/*0:1*/; +x/*0:01*/::bigint or y/*0:1*/::int = x/*0:01*/ or bigint y/*0:1*/; +x/*0:01*/::bigint and y/*0:1*/::int = x/*0:01*/ and bigint y/*0:1*/; x/*0:01*/::bigint<y/*0:1*/::int = x/*0:01*/<bigint y/*0:1*/; x/*0:01*/::bigint>y/*0:1*/::int = x/*0:01*/>bigint y/*0:1*/; x/*0:01*/::bigint<=y/*0:1*/::int = x/*0:01*/<=bigint y/*0:1*/; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-06-22 01:56:22
|
Revision: 278 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=278&view=rev Author: agraef Date: 2008-06-21 15:23:15 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Update prelude test log. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-06-21 21:43:52 UTC (rev 277) +++ pure/trunk/test/prelude.log 2008-06-21 22:23:15 UTC (rev 278) @@ -724,7 +724,7 @@ foldr f/*0:001*/ a/*0:01*/ [] = a/*0:01*/; foldr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:001*/ x/*0:101*/ (foldl (flip f/*0:001*/) a/*0:01*/ (reverse xs/*0:11*/)); foldr1 f/*0:01*/ [x/*0:101*/] = x/*0:101*/; -foldr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldr f/*0:01*/ x/*0:101*/ xs/*0:11*/; +foldr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:01*/ x/*0:101*/ (foldl1 (flip f/*0:01*/) (reverse xs/*0:11*/)); head (x/*0:101*/:xs/*0:11*/) = x/*0:101*/; init [x/*0:101*/] = []; init (x/*0:101*/:xs/*0:11*/) = accum/*0*/ [x/*0:101*/] xs/*0:11*/ with accum ys/*0:01*/ [] = reverse ys/*0:01*/; accum ys/*0:01*/ (x/*0:101*/:xs/*0:11*/) = accum/*1*/ (x/*0:101*/:ys/*0:01*/) xs/*0:11*/; accum ys/*0:01*/ xs/*0:1*/ = reverse ys/*0:01*/+init xs/*0:1*/ { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-07-01 14:06:23
|
Revision: 353 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=353&view=rev Author: agraef Date: 2008-07-01 07:06:22 -0700 (Tue, 01 Jul 2008) Log Message: ----------- Update logs. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-07-01 13:43:30 UTC (rev 352) +++ pure/trunk/test/prelude.log 2008-07-01 14:06:22 UTC (rev 353) @@ -1,3 +1,5 @@ +def false = 0; +def true = 1; throw x/*0:1*/ = pure_throw x/*0:1*/; assert p/*0:01*/ e/*0:1*/ = if p/*0:01*/ then 1 else throw e/*0:1*/; x/*0:01*/===y/*0:1*/ = same x/*0:01*/ y/*0:1*/; @@ -193,9 +195,6 @@ x/*0:01*/::double>=y/*0:1*/::bigint = x/*0:01*/>=double y/*0:1*/; x/*0:01*/::double==y/*0:1*/::bigint = x/*0:01*/==double y/*0:1*/; x/*0:01*/::double!=y/*0:1*/::bigint = x/*0:01*/!=double y/*0:1*/; -sqrt x/*0:1*/::int = c_sqrt (double x/*0:1*/) if x/*0:1*/>=0; -sqrt x/*0:1*/::bigint = c_sqrt (double x/*0:1*/) if x/*0:1*/>=0; -sqrt x/*0:1*/::double = c_sqrt x/*0:1*/ if x/*0:1*/>=0; pow x/*0:01*/::int y/*0:1*/::int = bigint_pow (bigint x/*0:01*/) y/*0:1*/ if y/*0:1*/>=0; pow x/*0:01*/::bigint y/*0:1*/::bigint = bigint_pow x/*0:01*/ (int y/*0:1*/) if int y/*0:1*/>=0; pow x/*0:01*/::double y/*0:1*/::double = c_pow x/*0:01*/ y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; @@ -214,6 +213,8 @@ x/*0:01*/::double^y/*0:1*/::bigint = c_pow x/*0:01*/ (double y/*0:1*/); x/*0:01*/::int^y/*0:1*/::double = c_pow (double x/*0:01*/) y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; x/*0:01*/::bigint^y/*0:1*/::double = c_pow (double x/*0:01*/) y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; +x/*0:01*/::int^y/*0:1*/::double = double x/*0:01*/^y/*0:1*/; +x/*0:01*/::bigint^y/*0:1*/::double = double x/*0:01*/^y/*0:1*/; null x/*0:1*/ = bigint x/*0:1*/==0; x/*0:01*/-y/*0:1*/ = bigint x/*0:01*/-bigint y/*0:1*/; x/*0:01*/+y/*0:1*/::int = pointer (bigint x/*0:01*/+y/*0:1*/); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-07-01 21:54:04
|
Revision: 358 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=358&view=rev Author: agraef Date: 2008-07-01 14:54:14 -0700 (Tue, 01 Jul 2008) Log Message: ----------- Update logs. Modified Paths: -------------- pure/trunk/test/prelude.log Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-07-01 21:53:10 UTC (rev 357) +++ pure/trunk/test/prelude.log 2008-07-01 21:54:14 UTC (rev 358) @@ -195,6 +195,14 @@ x/*0:01*/::double>=y/*0:1*/::bigint = x/*0:01*/>=double y/*0:1*/; x/*0:01*/::double==y/*0:1*/::bigint = x/*0:01*/==double y/*0:1*/; x/*0:01*/::double!=y/*0:1*/::bigint = x/*0:01*/!=double y/*0:1*/; +gcd x/*0:01*/::bigint y/*0:1*/::bigint = bigint_gcd x/*0:01*/ y/*0:1*/; +lcm x/*0:01*/::bigint y/*0:1*/::bigint = bigint_lcm x/*0:01*/ y/*0:1*/; +gcd x/*0:01*/::int y/*0:1*/::bigint = bigint_gcd (bigint x/*0:01*/) y/*0:1*/; +gcd x/*0:01*/::bigint y/*0:1*/::int = bigint_gcd x/*0:01*/ (bigint y/*0:1*/); +gcd x/*0:01*/::int y/*0:1*/::int = int (bigint_gcd (bigint x/*0:01*/) (bigint y/*0:1*/)); +lcm x/*0:01*/::int y/*0:1*/::bigint = bigint_lcm (bigint x/*0:01*/) y/*0:1*/; +lcm x/*0:01*/::bigint y/*0:1*/::int = bigint_lcm x/*0:01*/ (bigint y/*0:1*/); +lcm x/*0:01*/::int y/*0:1*/::int = int (bigint_lcm (bigint x/*0:01*/) (bigint y/*0:1*/)); pow x/*0:01*/::int y/*0:1*/::int = bigint_pow (bigint x/*0:01*/) y/*0:1*/ if y/*0:1*/>=0; pow x/*0:01*/::bigint y/*0:1*/::bigint = bigint_pow x/*0:01*/ (int y/*0:1*/) if int y/*0:1*/>=0; pow x/*0:01*/::double y/*0:1*/::double = c_pow x/*0:01*/ y/*0:1*/ if x/*0:01*/>=0||int y/*0:1*/==y/*0:1*/; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |