diff options
| author | Rich Hickey <richhickey@gmail.com> | 2006-06-09 13:14:02 +0000 |
|---|---|---|
| committer | Rich Hickey <richhickey@gmail.com> | 2006-06-09 13:14:02 +0000 |
| commit | e4e5b0612f3acbcd223e8a7c27510bf9a2dde856 (patch) | |
| tree | 221c8f9ae40359b665ce65b02c2eaec4700b4948 /src/cli/runtime | |
| parent | abb9f4e91313a368103e73f729de5792d3c5e435 (diff) | |
made ISequential
Diffstat (limited to 'src/cli/runtime')
| -rw-r--r-- | src/cli/runtime/PersistentListIdentityMap.cs | 47 | ||||
| -rw-r--r-- | src/cli/runtime/PersistentListMap.cs | 48 |
2 files changed, 93 insertions, 2 deletions
diff --git a/src/cli/runtime/PersistentListIdentityMap.cs b/src/cli/runtime/PersistentListIdentityMap.cs index 17f0794a..330aeb5b 100644 --- a/src/cli/runtime/PersistentListIdentityMap.cs +++ b/src/cli/runtime/PersistentListIdentityMap.cs @@ -31,7 +31,7 @@ namespace org.clojure.runtime * code duplication here is kind of gross, but most efficient
*/
- public class PersistentListIdentityMap : IPersistentMap, IMapEntry
+ public class PersistentListIdentityMap : IPersistentMap, IMapEntry, ISeq, ISequential
{
static public PersistentListIdentityMap EMPTY = new PersistentListIdentityMap();
@@ -96,6 +96,21 @@ namespace org.clojure.runtime return 0;
}
+ virtual public Object first()
+ {
+ return null;
+ }
+
+ virtual public ISeq rest()
+ {
+ return null;
+ }
+
+ virtual public ISeq seq()
+ {
+ return null;
+ }
+
internal class Iter : IEnumerator
{
PersistentListIdentityMap e;
@@ -207,6 +222,21 @@ namespace org.clojure.runtime return EMPTY;
return this;
}
+
+ override public Object first()
+ {
+ return this;
+ }
+
+ override public ISeq rest()
+ {
+ return null;
+ }
+
+ override public ISeq seq()
+ {
+ return this;
+ }
}
internal class Link : PersistentListIdentityMap
@@ -289,6 +319,21 @@ namespace org.clojure.runtime return count();
}
+ override public Object first()
+ {
+ return this;
+ }
+
+ override public ISeq rest()
+ {
+ return _rest;
+ }
+
+ override public ISeq seq()
+ {
+ return this;
+ }
+
PersistentListIdentityMap create(Object k, Object v, IPersistentMap r)
{
if (r == EMPTY)
diff --git a/src/cli/runtime/PersistentListMap.cs b/src/cli/runtime/PersistentListMap.cs index fa7b3874..8f53d0db 100644 --- a/src/cli/runtime/PersistentListMap.cs +++ b/src/cli/runtime/PersistentListMap.cs @@ -27,7 +27,7 @@ namespace org.clojure.runtime *
* null keys and values are ok, but you won't be able to distinguish a null value via get - use contains/find
*/
-public class PersistentListMap : IPersistentMap, IMapEntry
+public class PersistentListMap : IPersistentMap, IMapEntry, ISeq, ISequential
{
static public PersistentListMap EMPTY = new PersistentListMap();
@@ -80,6 +80,22 @@ public virtual int capacity(){ return 0;
}
+virtual public Object first()
+ {
+ return null;
+ }
+
+virtual public ISeq rest()
+ {
+ return null;
+ }
+
+virtual public ISeq seq()
+ {
+ return null;
+ }
+
+
internal class Iter : IEnumerator{
PersistentListMap e;
bool first = true;
@@ -185,6 +201,21 @@ internal class Tail : PersistentListMap { return EMPTY;
return this;
}
+
+ override public Object first()
+ {
+ return this;
+ }
+
+ override public ISeq rest()
+ {
+ return null;
+ }
+
+ override public ISeq seq()
+ {
+ return this;
+ }
}
internal class Link : PersistentListMap {
@@ -257,6 +288,21 @@ internal class Link : PersistentListMap { return count();
}
+ override public Object first()
+ {
+ return this;
+ }
+
+ override public ISeq rest()
+ {
+ return _rest;
+ }
+
+ override public ISeq seq()
+ {
+ return this;
+ }
+
PersistentListMap create(Object k, Object v, IPersistentMap r)
{
if(r == EMPTY)
|
