[pure-lang-svn] SF.net SVN: pure-lang:[688] pure/trunk/lib
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-09-03 07:30:12
|
Revision: 688
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=688&view=rev
Author: agraef
Date: 2008-09-03 07:30:21 +0000 (Wed, 03 Sep 2008)
Log Message:
-----------
Remove definitions for the slicing operator, which is now provided in a generic way in the prelude.
Modified Paths:
--------------
pure/trunk/lib/array.pure
pure/trunk/lib/dict.pure
Modified: pure/trunk/lib/array.pure
===================================================================
--- pure/trunk/lib/array.pure 2008-09-03 07:09:12 UTC (rev 687)
+++ pure/trunk/lib/array.pure 2008-09-03 07:30:21 UTC (rev 688)
@@ -37,11 +37,6 @@
a!i return ith member of a
a!(i,j) two-dimensional subscript
- a!!is slicing (get a list of values from a list
- indices
- a!!ijs slicing of two-dimensional array (from a given
- list of pairs [(i, j), ...])
-
null a tests whether a is the empty array
members a list of values stored in a
members2 a list of members in a two-dimensional array
@@ -108,14 +103,6 @@
// get value by indices from two-dimensional array
x@(Array _)!(i::int, j::int) = x!i!j;
-// slicing (get list of values from list of indices)
-a@(Array _)!!is@(_::int:_) = [a!i; i = is; (i >= 0) && (i < (#a))];
-
-// slicing of two-dimensional array
-a@(Array _)!!ijs@((_::int, _::int):_)
- = [a!(i, j); (i, j) = ijs; (i >= 0) && (i < (#a))
- && (j >= 0) && (j < (#(a!i)))];
-
// check for an empty array
null (Array nil) = 1;
null (Array _) = 0;
Modified: pure/trunk/lib/dict.pure
===================================================================
--- pure/trunk/lib/dict.pure 2008-09-03 07:09:12 UTC (rev 687)
+++ pure/trunk/lib/dict.pure 2008-09-03 07:30:21 UTC (rev 688)
@@ -53,8 +53,6 @@
#d size of dict or hdict d
d!x: get value from d by key x
-d!!xs slicing (get a list of values
- from a list of keys)
null d tests whether d is the empty dict or hdict
member d x tests whether d contains member with key x
@@ -431,45 +429,6 @@
lookupk ( _ :xys) x = lookupk xys x
end;
-// slicing (get list of values from list of keys)
-(Dict d)!!xs = slice d [] xs
-with
- slice d ys (x:xs) = slice d
- (case mbr of nil = ys;
- (nonil y) = (y:ys) end) xs
- when
- mbr = d!x
- end;
- slice d ys [] = reverse ys;
-
- nil!_ = nil;
- (bin x y _ d1 d2)!x1
- = d1!x1 if x1 < x;
- = d2!x1 if x1 > x;
- = nonil y
-end;
-
-(Hdict d)!!xs = slice d [] xs
-with
- slice d ys (x:xs) = slice d
- (case mbr of nil = ys;
- (nonil y) = (y:ys) end) xs
- when
- mbr = lookup d (hash x) x
- end;
- slice d ys [] = reverse ys;
-
- lookup nil _ _ = nil;
- lookup (bin k::int xys _ d1 d2) k1::int x1
- = lookup d1 k1 x1 if k > k1;
- = lookup d2 k1 x1 if k < k1;
- = lookupk xys x1;
-
- lookupk [] _ = nil;
- lookupk ((xa => y):_ ) xb = nonil y if xa === xb;
- lookupk ( _ :xys) x = lookupk xys x
-end;
-
// curried version of insert for dict and hdict
update d@(Dict _) x y |
update d@(Hdict _) x y
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|