[svn] r6667: nemerle/trunk/lib/narray.n

VladD2 svnadmin at nemerle.org
Tue Sep 19 17:33:55 CEST 2006


Log:
Add Filter() method to NArray class.

Author: VladD2
Date: Tue Sep 19 17:33:54 2006
New Revision: 6667

Modified:
   nemerle/trunk/lib/narray.n

Modified: nemerle/trunk/lib/narray.n
==============================================================================
--- nemerle/trunk/lib/narray.n	(original)
+++ nemerle/trunk/lib/narray.n	Tue Sep 19 17:33:54 2006
@@ -518,6 +518,14 @@
     }
 
     /**
+     * Filter elements to list.
+     */
+    public Filter [T] (ary : array [T], predicate : T -> bool) : list [T]
+    {
+      $[ x | x in ary, predicate (x) ]
+    }
+
+    /**
      * Cast array to covariant subtype.
      */
     public ToBase[Derive, Base] (this source : array [Derive]) : array [Base]



More information about the svn mailing list