[pure-lang-svn] SF.net SVN: pure-lang:[805] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-20 09:50:09
|
Revision: 805 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=805&view=rev Author: agraef Date: 2008-09-20 09:49:59 +0000 (Sat, 20 Sep 2008) Log Message: ----------- Cosmetic changes to arithmetic sequence syntax, to make it easier to write matrix slices. Modified Paths: -------------- pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-09-20 09:24:14 UTC (rev 804) +++ pure/trunk/lib/prelude.pure 2008-09-20 09:49:59 UTC (rev 805) @@ -45,8 +45,8 @@ infixl 0 $$ ; // sequence operator infixr 0 $ ; // right-associative application -infix 1 .. ; // arithmetic sequences infixr 1 , ; // pair (tuple) +infix 2 .. ; // arithmetic sequences infix 2 => ; // mapsto constructor infixr 2 || ; // logical or (short-circuit) infixr 3 && ; // logical and (short-circuit) @@ -254,7 +254,7 @@ /* Arithmetic sequences. */ -n1,n2..m = if m===s*inf then iterate (\x->x+k) n1 +n1:n2..m = if m===s*inf then iterate (\x->x+k) n1 else while (\i->s*i<=s*m) (\x->x+k) n1 when k = n2-n1; s = if k>0 then 1 else -1 end if n1!=n2; n..m = if m===inf then iterate (\x->x+1) n Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-09-20 09:24:14 UTC (rev 804) +++ pure/trunk/test/prelude.log 2008-09-20 09:49:59 UTC (rev 805) @@ -319,7 +319,7 @@ <var> state 2 state 2: #0 } end; -n1/*0:0101*/,n2/*0:011*/..m/*0:1*/ = if m/*2:1*/===s/*0:*/*inf then iterate (\x/*0:*/ -> x/*0:*/+k/*2:*/ { +n1/*0:0101*/:n2/*0:011*/..m/*0:1*/ = if m/*2:1*/===s/*0:*/*inf then iterate (\x/*0:*/ -> x/*0:*/+k/*2:*/ { rule #0: x = x+k state 0: #0 <var> state 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |