diff options
author | Rich Hickey <richhickey@gmail.com> | 2006-07-27 22:21:53 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2006-07-27 22:21:53 +0000 |
commit | f0ebcbc30c8f2ae9144259caed61495ef753ab72 (patch) | |
tree | ce8d3a7e5e5fa48d1482676d19236c56364c9e8e | |
parent | 3224d6ff2e2e28a6e283a3106992dc0545d4e1b6 (diff) |
made set() return Tuple
-rw-r--r-- | src/cli/runtime/Tuple.cs | 11 | ||||
-rw-r--r-- | src/jvm/clojure/lang/Tuple.java | 11 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/cli/runtime/Tuple.cs b/src/cli/runtime/Tuple.cs index 1ee8de4f..59799b30 100644 --- a/src/cli/runtime/Tuple.cs +++ b/src/cli/runtime/Tuple.cs @@ -37,14 +37,11 @@ public Object get(int i){ return array[i];
}
-/**
- *
- * @param i
- * @param val
- * @return a PersistentArray
- */
+
public IArray set(int i, Object val) {
- return (new PersistentArray(this)).set(i, val);
+ Object[] newArray = (Object[])array.Clone();
+ newArray[i] = val;
+ return new Tuple(newArray);
}
override public bool Equals(Object key){
diff --git a/src/jvm/clojure/lang/Tuple.java b/src/jvm/clojure/lang/Tuple.java index b105479f..41e0048b 100644 --- a/src/jvm/clojure/lang/Tuple.java +++ b/src/jvm/clojure/lang/Tuple.java @@ -34,14 +34,11 @@ public Object get(int i){ return array[i]; } -/** - * - * @param i - * @param val - * @return a PersistentArray - */ + public IArray set(int i, Object val) { - return (new PersistentArray(this)).set(i, val); + Object[] newArray = array.clone(); + newArray[i] = val; + return new Tuple(newArray); } public boolean equals(Object key){ |