diff options
| author | Rich Hickey <richhickey@gmail.com> | 2006-08-05 19:24:17 +0000 |
|---|---|---|
| committer | Rich Hickey <richhickey@gmail.com> | 2006-08-05 19:24:17 +0000 |
| commit | 397f768ca30a4615c753ec544dedc5c39be7743b (patch) | |
| tree | 00dd0db8e2efb38df35f942e108eab721887c457 /src/cli/runtime/PersistentListMap.cs | |
| parent | a619d3a6f9cde068d0945ab26b275113c8ffde1b (diff) | |
added PersistentList, changed RT.cons to work with all collections
Diffstat (limited to 'src/cli/runtime/PersistentListMap.cs')
| -rw-r--r-- | src/cli/runtime/PersistentListMap.cs | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/cli/runtime/PersistentListMap.cs b/src/cli/runtime/PersistentListMap.cs index 272ca299..e632a67a 100644 --- a/src/cli/runtime/PersistentListMap.cs +++ b/src/cli/runtime/PersistentListMap.cs @@ -27,7 +27,7 @@ namespace clojure.lang *
* 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 : APersistentMap, IMapEntry, ISeq
+public class PersistentListMap : APersistentMap, IMapEntry
{
static public PersistentListMap EMPTY = new PersistentListMap();
@@ -218,19 +218,25 @@ internal class Tail : PersistentListMap { return this;
}
- override public Object first()
- {
- return this;
- }
+ class Seq : ASeq{
+ Tail t;
- override public ISeq rest()
- {
- return null;
- }
+ public Seq(Tail t) {
+ this.t = t;
+ }
+ override public Object first()
+ {
+ return t;
+ }
+ override public ISeq rest()
+ {
+ return null;
+ }
+ }
override public ISeq seq()
{
- return this;
+ return new Seq(this);
}
}
@@ -317,20 +323,25 @@ internal class Link : PersistentListMap { return null;
}
+ class Seq : ASeq{
+ Link lnk;
- override public Object first()
- {
- return this;
- }
+ public Seq(Link lnk) {
+ this.lnk = lnk;
+ }
- override public ISeq rest()
- {
- return _rest;
+ override public Object first() {
+ return lnk;
+ }
+
+ override public ISeq rest() {
+ return lnk._rest.seq();
+ }
}
override public ISeq seq()
{
- return this;
+ return new Seq(this);
}
PersistentListMap create(Object k, Object v, IPersistentMap r)
|
