diff options
Diffstat (limited to 'src/cli/runtime')
-rw-r--r-- | src/cli/runtime/APersistentMap.cs | 4 | ||||
-rw-r--r-- | src/cli/runtime/IArray.cs | 2 | ||||
-rw-r--r-- | src/cli/runtime/IPersistentMap.cs | 4 | ||||
-rw-r--r-- | src/cli/runtime/MapEntry.cs | 4 | ||||
-rw-r--r-- | src/cli/runtime/PersistentArrayMap.cs | 6 | ||||
-rw-r--r-- | src/cli/runtime/PersistentHashtableMap.cs | 10 | ||||
-rw-r--r-- | src/cli/runtime/PersistentListMap.cs | 16 | ||||
-rw-r--r-- | src/cli/runtime/PersistentTreeMap.cs | 4 | ||||
-rw-r--r-- | src/cli/runtime/TObj.cs | 2 | ||||
-rw-r--r-- | src/cli/runtime/Var.cs | 2 |
10 files changed, 27 insertions, 27 deletions
diff --git a/src/cli/runtime/APersistentMap.cs b/src/cli/runtime/APersistentMap.cs index 9a9170d5..5b560036 100644 --- a/src/cli/runtime/APersistentMap.cs +++ b/src/cli/runtime/APersistentMap.cs @@ -28,10 +28,10 @@ public abstract class APersistentMap : Obj, IPersistentMap{ #region IPersistentMap Members
- abstract public IPersistentMap add(object key, object val);
+ abstract public IPersistentMap assocEx(object key, object val);
- abstract public IPersistentMap remove(object key);
+ abstract public IPersistentMap without(object key);
diff --git a/src/cli/runtime/IArray.cs b/src/cli/runtime/IArray.cs index 736d1679..09e1bbe6 100644 --- a/src/cli/runtime/IArray.cs +++ b/src/cli/runtime/IArray.cs @@ -13,7 +13,7 @@ using System; namespace clojure.lang
{ -public interface IArray : IPersistentCollection, Associative {
+public interface IArray : IPersistentCollection, Associative, Sequential {
int length();
Object nth(int i);
diff --git a/src/cli/runtime/IPersistentMap.cs b/src/cli/runtime/IPersistentMap.cs index d9d3991a..055746ce 100644 --- a/src/cli/runtime/IPersistentMap.cs +++ b/src/cli/runtime/IPersistentMap.cs @@ -17,9 +17,9 @@ namespace clojure.lang public interface IPersistentMap : Associative, IEnumerable, IPersistentCollection{
-IPersistentMap add(Object key, Object val);
+IPersistentMap assocEx(Object key, Object val);
-IPersistentMap remove(Object key);
+IPersistentMap without(Object key);
}
diff --git a/src/cli/runtime/MapEntry.cs b/src/cli/runtime/MapEntry.cs index 0e86f56a..13051107 100644 --- a/src/cli/runtime/MapEntry.cs +++ b/src/cli/runtime/MapEntry.cs @@ -52,13 +52,13 @@ override public Object get(Object key) { return RT.equal(_key, key)?_val:null;
}
-override public IPersistentMap add(Object key, Object val) {
+override public IPersistentMap assocEx(Object key, Object val) {
if(RT.equal(_key, key))
throw new Exception("Key already present");
return assoc(key, val);
}
-override public IPersistentMap remove(Object key) {
+override public IPersistentMap without(Object key) {
if(RT.equal(_key, key))
return (IPersistentMap) PersistentArrayMap.EMPTY.withMeta(_meta);
return this;
diff --git a/src/cli/runtime/PersistentArrayMap.cs b/src/cli/runtime/PersistentArrayMap.cs index ebea6ebd..4e27ad16 100644 --- a/src/cli/runtime/PersistentArrayMap.cs +++ b/src/cli/runtime/PersistentArrayMap.cs @@ -78,7 +78,7 @@ public IMapEntry find(Object key) { return null;
}
-public IPersistentMap add(Object key, Object val) {
+public IPersistentMap assocEx(Object key, Object val) {
int i = indexOf(key);
Object[] newArray;
if(i >= 0)
@@ -88,7 +88,7 @@ public IPersistentMap add(Object key, Object val) { else //didn't have key, grow
{
if (array.Length > HASHTABLE_THRESHOLD)
- return createHT(array).add(key, val);
+ return createHT(array).assocEx(key, val);
newArray = new Object[array.Length + 2];
if(array.Length > 0)
Array.Copy(array,0,newArray,2,array.Length);
@@ -121,7 +121,7 @@ public IPersistentMap assoc(Object key, Object val) { return create(newArray);
}
-public IPersistentMap remove(Object key) {
+public IPersistentMap without(Object key) {
int i = indexOf(key);
if(i >= 0) //have key, will remove
{
diff --git a/src/cli/runtime/PersistentHashtableMap.cs b/src/cli/runtime/PersistentHashtableMap.cs index 7d765aca..a833fa4c 100644 --- a/src/cli/runtime/PersistentHashtableMap.cs +++ b/src/cli/runtime/PersistentHashtableMap.cs @@ -89,9 +89,9 @@ public IMapEntry find(Object key) { return null;
}
-public IPersistentMap add(Object key, Object val) {
+public IPersistentMap assocEx(Object key, Object val) {
if(_count > growAtCount)
- return grow().add(key, val);
+ return grow().assocEx(key, val);
int i = bucketFor(key,array);
int incr = 1;
PersistentArray newArray = doAdd(i, key, val, array);
@@ -132,19 +132,19 @@ PersistentArray doAdd(int i,Object key,Object val,PersistentArray array) { IPersistentMap newEntries;
if (entries != null)
{
- newEntries = entries.add(key, val);
+ newEntries = entries.assocEx(key, val);
}
else
newEntries = createListMap(key, val);
return (PersistentArray)array.assocN(i, newEntries);
}
-public IPersistentMap remove(Object key) {
+public IPersistentMap without(Object key) {
int i = bucketFor(key,array);
IPersistentMap entries = (IPersistentMap) array.nth(i);
if (entries != null)
{
- IPersistentMap newEntries = entries.remove(key);
+ IPersistentMap newEntries = entries.without(key);
if (newEntries != entries)
return create(_count - 1, (PersistentArray)array.assocN(i, newEntries));
}
diff --git a/src/cli/runtime/PersistentListMap.cs b/src/cli/runtime/PersistentListMap.cs index d86bdab8..948a70c4 100644 --- a/src/cli/runtime/PersistentListMap.cs +++ b/src/cli/runtime/PersistentListMap.cs @@ -67,7 +67,7 @@ public virtual IMapEntry find(Object key){ return null;
}
-public virtual IPersistentMap add(Object key, Object val){
+public virtual IPersistentMap assocEx(Object key, Object val){
return assoc(key, val);
}
@@ -75,7 +75,7 @@ public virtual IPersistentMap assoc(Object key, Object val){ return new Tail(key, val, _meta);
}
-public virtual IPersistentMap remove(Object key){
+public virtual IPersistentMap without(Object key){
return this;
}
@@ -193,7 +193,7 @@ internal class Tail : PersistentListMap { return null;
}
- override public IPersistentMap add(Object key, Object val)
+ override public IPersistentMap assocEx(Object key, Object val)
{
if (equalKey(key, _key))
{
@@ -213,7 +213,7 @@ internal class Tail : PersistentListMap { return new Link(key,val,this,_meta);
}
- override public IPersistentMap remove(Object key){
+ override public IPersistentMap without(Object key){
if(equalKey(key,_key))
{
if(_meta == null)
@@ -279,7 +279,7 @@ internal class Link : PersistentListMap { return _rest.find(key);
}
- override public IPersistentMap add(Object key, Object val)
+ override public IPersistentMap assocEx(Object key, Object val)
{
IMapEntry e = find(key);
if(e != null)
@@ -296,12 +296,12 @@ internal class Link : PersistentListMap { {
if(e.val() == val)
return this;
- return create(_key,_val,remove(key));
+ return create(_key,_val,without(key));
}
return new Link(key,val,this,_meta);
}
- override public IPersistentMap remove(Object key)
+ override public IPersistentMap without(Object key)
{
if(equalKey(key,_key))
{
@@ -309,7 +309,7 @@ internal class Link : PersistentListMap { return _rest;
return (IPersistentMap)_rest.withMeta(_meta);
}
- PersistentListMap r = (PersistentListMap)_rest.remove(key);
+ PersistentListMap r = (PersistentListMap)_rest.without(key);
if(r == _rest) //not there
return this;
return create(_key,_val,r);
diff --git a/src/cli/runtime/PersistentTreeMap.cs b/src/cli/runtime/PersistentTreeMap.cs index 44f76f45..f82e59b2 100644 --- a/src/cli/runtime/PersistentTreeMap.cs +++ b/src/cli/runtime/PersistentTreeMap.cs @@ -59,7 +59,7 @@ public bool contains(Object key){ return find(key) != null; }
-public IPersistentMap add(Object key,Object val){ +public IPersistentMap assocEx(Object key,Object val){ Box found = new Box(null); Node t = add(tree, key, val, found); if(t == null) //null == already contains key @@ -83,7 +83,7 @@ public IPersistentMap assoc(Object key, Object val){ } -public IPersistentMap remove(Object key){ +public IPersistentMap without(Object key){ Box found = new Box(null); Node t = remove(tree, key, found); if(t == null) diff --git a/src/cli/runtime/TObj.cs b/src/cli/runtime/TObj.cs index 1f98cd1a..a81fb4ef 100644 --- a/src/cli/runtime/TObj.cs +++ b/src/cli/runtime/TObj.cs @@ -44,7 +44,7 @@ public IPersistentMap attrs() { public void removeAttr(Object key) {
IPersistentMap t = (IPersistentMap) Transaction.get( _attrs);
- t = t.remove(key);
+ t = t.without(key);
Transaction.set(_attrs,t);
}
}
diff --git a/src/cli/runtime/Var.cs b/src/cli/runtime/Var.cs index 748f60ad..13d10034 100644 --- a/src/cli/runtime/Var.cs +++ b/src/cli/runtime/Var.cs @@ -47,7 +47,7 @@ Binding getThreadBinding()
{ {
tb = threadBindings;
if (b == null)
- newtb = tb.remove(thread);
+ newtb = tb.without(thread);
else
newtb = tb.assoc(thread, b);
} while (tb != Interlocked.CompareExchange(ref threadBindings, newtb, tb));
|