[pure-lang-svn] SF.net SVN: pure-lang:[800] pure/trunk/lib/primitives.pure
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-20 07:56:36
|
Revision: 800 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=800&view=rev Author: agraef Date: 2008-09-20 07:56:32 +0000 (Sat, 20 Sep 2008) Log Message: ----------- Implement array slicing operations. Modified Paths: -------------- pure/trunk/lib/primitives.pure Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-09-20 07:03:48 UTC (rev 799) +++ pure/trunk/lib/primitives.pure 2008-09-20 07:56:32 UTC (rev 800) @@ -430,6 +430,16 @@ when n::int,m::int = dim x end); = throw out_of_bounds otherwise; +/* Slices. */ + +x::matrix!!(ns,ms) = colcatmap (mth (rowcatmap (nth x) ns)) ms with + nth x n = catch (cst {}) (row x n); + mth x m = catch (cst {}) (col x m); + end; +x::matrix!!ns = colcatmap (nth x) ns with + nth x n = catch (cst {}) {x!n}; + end; + /* Extract rows and columns from a matrix. */ private matrix_slice; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |