diff options
Diffstat (limited to 'src/cli/runtime/ArraySeq.cs')
-rw-r--r-- | src/cli/runtime/ArraySeq.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cli/runtime/ArraySeq.cs b/src/cli/runtime/ArraySeq.cs index c0e450b4..bdfbc145 100644 --- a/src/cli/runtime/ArraySeq.cs +++ b/src/cli/runtime/ArraySeq.cs @@ -18,8 +18,9 @@ namespace clojure.lang public class ArraySeq : IndexedSeq{
readonly Object[] array;
readonly int i;
+ISeq _rest;
-static public ArraySeq create(Object[] array){
+static public ArraySeq create(params Object[] array){
if(array.Length == 0)
return null;
return new ArraySeq(array, 0);
@@ -28,6 +29,7 @@ static public ArraySeq create(Object[] array){ ArraySeq(Object[] array, int i){
this.array = array;
this.i = i;
+ this._rest = this;
}
public Object first() {
@@ -35,9 +37,13 @@ public Object first() { }
public ISeq rest() {
- if(i+1 < array.Length)
- return new ArraySeq(array, i + 1);
- return null;
+ if(_rest == this)
+ {
+ if(i+1 < array.Length)
+ _rest = new ArraySeq(array, i + 1);
+ _rest = null;
+ }
+ return _rest;
}
public int index(){
|