summaryrefslogtreecommitdiff
path: root/src/cli/runtime/PersistentTree.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/runtime/PersistentTree.cs')
-rw-r--r--src/cli/runtime/PersistentTree.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cli/runtime/PersistentTree.cs b/src/cli/runtime/PersistentTree.cs
index b9335bdf..36f0346f 100644
--- a/src/cli/runtime/PersistentTree.cs
+++ b/src/cli/runtime/PersistentTree.cs
@@ -52,9 +52,14 @@ public bool contains(Object key){
return find(key) != null;
}
- public IPersistentMap add(Object key)
+public IPersistentMap add(Object key,Object val){
+ Box found = new Box(null);
+ Node t = add(tree, key, val, found);
+ if(t == null) //null == already contains key
{
- return put(key, null);
+ throw new Exception("Key already present");
+ }
+ return new PersistentTree(comp, t.blacken(), _count + 1);
}
public IPersistentMap put(Object key, Object val){
@@ -778,7 +783,7 @@ public void Reset()
#endregion
}
- /*
+ //*
[STAThread]
static public void Main(String[] args){
if(args.Length != 1)