[pure-lang-svn] SF.net SVN: pure-lang:[600] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-24 09:57:28
|
Revision: 600 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=600&view=rev Author: agraef Date: 2008-08-24 09:57:38 +0000 (Sun, 24 Aug 2008) Log Message: ----------- do operations now implemented with $$. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-24 02:19:25 UTC (rev 599) +++ pure/trunk/ChangeLog 2008-08-24 09:57:38 UTC (rev 600) @@ -2,6 +2,8 @@ * 0.5 release. + * lib/prelude.pure: do operations now implemented with $$. + * test/test020.pure, test/test021.pure: Cosmetic changes, added math.pure tests for checking exact/inexact/symbolic results. Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-08-24 02:19:25 UTC (rev 599) +++ pure/trunk/lib/prelude.pure 2008-08-24 09:57:38 UTC (rev 600) @@ -227,7 +227,7 @@ any p (x:xs) = if p x then 1 else any p xs; do f [] = (); -do f (x:xs) = do f xs when _ = f x end; +do f (x:xs) = f x $$ do f xs; drop n::int [] = []; drop n::int (x:xs) @@ -403,11 +403,11 @@ accum us _ _ _ = reverse us; end; -dowith f (x:xs) (y:ys) = dowith f xs ys when _ = f x y end; +dowith f (x:xs) (y:ys) = f x y $$ dowith f xs ys; dowith f _ _ = () otherwise; dowith3 f (x:xs) (y:ys) (z:zs) - = dowith3 f xs ys zs when _ = f x y z end; + = f x y z $$ dowith3 f xs ys zs; dowith3 f _ _ _ = () otherwise; unzip [] = [],[]; Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-08-24 02:19:25 UTC (rev 599) +++ pure/trunk/test/prelude.log 2008-08-24 09:57:38 UTC (rev 600) @@ -299,12 +299,7 @@ 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*/; 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 - state 0: #0 - <var> state 1 - state 1: #0 -} end; +do f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:01*/ x/*0:101*/$$do f/*0:01*/ xs/*0:11*/; drop n/*0:01*/::int [] = []; drop n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = drop (n/*0:01*/-1) xs/*0:11*/ if n/*0:01*/>0; drop n/*0:01*/::int (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:xs/*0:11*/; @@ -1072,19 +1067,9 @@ <var> state 43 state 43: #0 #1 } end; -dowith f/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = dowith f/*1:001*/ xs/*1:011*/ ys/*1:11*/ when _/*0:*/ = f/*0:001*/ x/*0:0101*/ y/*0:101*/ { - rule #0: _ = f x y - state 0: #0 - <var> state 1 - state 1: #0 -} end; +dowith f/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = f/*0:001*/ x/*0:0101*/ y/*0:101*/$$dowith f/*0:001*/ xs/*0:011*/ ys/*0:11*/; dowith f/*0:001*/ _/*0:01*/ _/*0:1*/ = (); -dowith3 f/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = dowith3 f/*1:0001*/ xs/*1:0011*/ ys/*1:011*/ zs/*1:11*/ when _/*0:*/ = f/*0:0001*/ x/*0:00101*/ y/*0:0101*/ z/*0:101*/ { - rule #0: _ = f x y z - state 0: #0 - <var> state 1 - state 1: #0 -} end; +dowith3 f/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = f/*0:0001*/ x/*0:00101*/ y/*0:0101*/ z/*0:101*/$$dowith3 f/*0:0001*/ xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; dowith3 f/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = (); unzip [] = [],[]; unzip ((x/*0:10101*/,y/*0:1011*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:1011*/:ys/*0:1*/ when xs/*0:01*/,ys/*0:1*/ = accum/*0*/ [] [] us/*0:11*/ { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |