diff options
Diffstat (limited to 'src/jvm')
25 files changed, 2338 insertions, 983 deletions
diff --git a/src/jvm/clojure/lang/ATransientMap.java b/src/jvm/clojure/lang/ATransientMap.java new file mode 100644 index 00000000..0f17ba6f --- /dev/null +++ b/src/jvm/clojure/lang/ATransientMap.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +package clojure.lang; + +import java.util.Map; + +import clojure.lang.PersistentHashMap.INode; + +abstract class ATransientMap extends AFn implements ITransientMap { + abstract void ensureEditable(); + abstract ITransientMap doAssoc(Object key, Object val); + abstract ITransientMap doWithout(Object key); + abstract Object doValAt(Object key, Object notFound); + abstract int doCount(); + abstract IPersistentMap doPersistent(); + + public ITransientMap conj(Object o) { + ensureEditable(); + if(o instanceof Map.Entry) + { + Map.Entry e = (Map.Entry) o; + + return assoc(e.getKey(), e.getValue()); + } + else if(o instanceof IPersistentVector) + { + IPersistentVector v = (IPersistentVector) o; + if(v.count() != 2) + throw new IllegalArgumentException("Vector arg to map conj must be a pair"); + return assoc(v.nth(0), v.nth(1)); + } + + ITransientMap ret = this; + for(ISeq es = RT.seq(o); es != null; es = es.next()) + { + Map.Entry e = (Map.Entry) es.first(); + ret = ret.assoc(e.getKey(), e.getValue()); + } + return ret; + } + + public final Object invoke(Object arg1) throws Exception{ + return valAt(arg1); + } + + public final Object invoke(Object arg1, Object notFound) throws Exception{ + return valAt(arg1, notFound); + } + + public final Object valAt(Object key) { + return valAt(key, null); + } + + public final ITransientMap assoc(Object key, Object val) { + ensureEditable(); + return doAssoc(key, val); + } + + public final ITransientMap without(Object key) { + ensureEditable(); + return doWithout(key); + } + + public final IPersistentMap persistent() { + ensureEditable(); + return doPersistent(); + } + + public final Object valAt(Object key, Object notFound) { + ensureEditable(); + return doValAt(key, notFound); + } + + public final int count() { + ensureEditable(); + return doCount(); + } +} diff --git a/src/jvm/clojure/lang/ATransientSet.java b/src/jvm/clojure/lang/ATransientSet.java new file mode 100644 index 00000000..6eec807a --- /dev/null +++ b/src/jvm/clojure/lang/ATransientSet.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Mar 3, 2008 */ + +package clojure.lang; + +public abstract class ATransientSet extends AFn implements ITransientSet{ + ITransientMap impl; + + ATransientSet(ITransientMap impl) { + this.impl = impl; + } + + public int count() { + return impl.count(); + } + + public ITransientSet conj(Object val) { + ITransientMap m = impl.assoc(val, val); + if (m != impl) this.impl = m; + return this; + } + + public boolean contains(Object key) { + return this != impl.valAt(key, this); + } + + public ITransientSet disjoin(Object key) throws Exception { + ITransientMap m = impl.without(key); + if (m != impl) this.impl = m; + return this; + } + + public Object get(Object key) { + return impl.valAt(key); + } + + public Object invoke(Object key, Object notFound) throws Exception { + return impl.valAt(key, notFound); + } + + public Object invoke(Object key) throws Exception { + return impl.valAt(key); + } + +} diff --git a/src/jvm/clojure/lang/ArraySeq.java b/src/jvm/clojure/lang/ArraySeq.java index 0373dd43..117dd4f5 100644 --- a/src/jvm/clojure/lang/ArraySeq.java +++ b/src/jvm/clojure/lang/ArraySeq.java @@ -42,6 +42,12 @@ static ISeq createFromObject(Object array){ return new ArraySeq_double(null, (double[]) array, 0); if(aclass == long[].class) return new ArraySeq_long(null, (long[]) array, 0); + if(aclass == byte[].class) + return new ArraySeq_byte(null, (byte[]) array, 0); + if(aclass == char[].class) + return new ArraySeq_char(null, (char[]) array, 0); + if(aclass == boolean[].class) + return new ArraySeq_boolean(null, (boolean[]) array, 0); return new ArraySeq(array, 0); } @@ -122,6 +128,39 @@ public Object reduce(IFn f, Object start) throws Exception{ return ret; } +public int indexOf(Object o) { + if (oa != null) { + for (int j = i; j < oa.length; j++) + if (Util.equals(o, oa[j])) return j - i; + } else { + int n = Array.getLength(array); + for (int j = i; j < n; j++) + if (Util.equals(o, Reflector.prepRet(Array.get(array, j)))) return j - i; + } + return -1; +} + +public int lastIndexOf(Object o) { + if (oa != null) { + if (o == null) { + for (int j = oa.length - 1 ; j >= i; j--) + if (oa[j] == null) return j - i; + } else { + for (int j = oa.length - 1 ; j >= i; j--) + if (o.equals(oa[j])) return j - i; + } + } else { + if (o == null) { + for (int j = Array.getLength(array) - 1 ; j >= i; j--) + if (Reflector.prepRet(Array.get(array, j)) == null) return j - i; + } else { + for (int j = Array.getLength(array) - 1 ; j >= i; j--) + if (o.equals(Reflector.prepRet(Array.get(array, j)))) return j - i; + } + } + return -1; +} + //////////////////////////////////// specialized primitive versions /////////////////////////////// static public class ArraySeq_int extends ASeq implements IndexedSeq, IReduce{ @@ -169,6 +208,34 @@ static public class ArraySeq_int extends ASeq implements IndexedSeq, IReduce{ ret = f.invoke(ret, array[x]); return ret; } + + public int indexOf(Object o) { + if (o instanceof Integer) { + int k = ((Integer) o).intValue(); + for (int j = i; j < array.length; j++) + if (k == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Integer) { + int k = ((Integer) o).intValue(); + for (int j = array.length - 1; j >= i; j--) + if (k == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } } @@ -217,6 +284,34 @@ static public class ArraySeq_float extends ASeq implements IndexedSeq, IReduce{ ret = f.invoke(ret, array[x]); return ret; } + + public int indexOf(Object o) { + if (o instanceof Float) { + float f = ((Float) o).floatValue(); + for (int j = i; j < array.length; j++) + if (f == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Float) { + float f = ((Float) o).floatValue(); + for (int j = array.length - 1; j >= i; j--) + if (f == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } } static public class ArraySeq_double extends ASeq implements IndexedSeq, IReduce{ @@ -264,6 +359,34 @@ static public class ArraySeq_double extends ASeq implements IndexedSeq, IReduce{ ret = f.invoke(ret, array[x]); return ret; } + + public int indexOf(Object o) { + if (o instanceof Double) { + double d = ((Double) o).doubleValue(); + for (int j = i; j < array.length; j++) + if (d == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Double) { + double d = ((Double) o).doubleValue(); + for (int j = array.length - 1; j >= i; j--) + if (d == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } } static public class ArraySeq_long extends ASeq implements IndexedSeq, IReduce{ @@ -311,6 +434,259 @@ static public class ArraySeq_long extends ASeq implements IndexedSeq, IReduce{ ret = f.invoke(ret, array[x]); return ret; } + + public int indexOf(Object o) { + if (o instanceof Long) { + long l = ((Long) o).longValue(); + for (int j = i; j < array.length; j++) + if (l == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Long) { + long l = ((Long) o).longValue(); + for (int j = array.length - 1; j >= i; j--) + if (l == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } +} + +static public class ArraySeq_byte extends ASeq implements IndexedSeq, IReduce{ + final byte[] array; + final int i; + + ArraySeq_byte(IPersistentMap meta, byte[] array, int i){ + super(meta); + this.array = array; + this.i = i; + } + + public Object first(){ + return array[i]; + } + + public ISeq next(){ + if(i + 1 < array.length) + return new ArraySeq_byte(meta(), array, i + 1); + return null; + } + + public int count(){ + return array.length - i; + } + + public int index(){ + return i; + } + + public ArraySeq_byte withMeta(IPersistentMap meta){ + return new ArraySeq_byte(meta, array, i); + } + + public Object reduce(IFn f) throws Exception{ + Object ret = array[i]; + for(int x = i + 1; x < array.length; x++) + ret = f.invoke(ret, array[x]); + return ret; + } + + public Object reduce(IFn f, Object start) throws Exception{ + Object ret = f.invoke(start, array[i]); + for(int x = i + 1; x < array.length; x++) + ret = f.invoke(ret, array[x]); + return ret; + } + + public int indexOf(Object o) { + if (o instanceof Byte) { + byte b = ((Byte) o).byteValue(); + for (int j = i; j < array.length; j++) + if (b == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Byte) { + byte b = ((Byte) o).byteValue(); + for (int j = array.length - 1; j >= i; j--) + if (b == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } +} + +static public class ArraySeq_char extends ASeq implements IndexedSeq, IReduce{ + final char[] array; + final int i; + + ArraySeq_char(IPersistentMap meta, char[] array, int i){ + super(meta); + this.array = array; + this.i = i; + } + + public Object first(){ + return array[i]; + } + + public ISeq next(){ + if(i + 1 < array.length) + return new ArraySeq_char(meta(), array, i + 1); + return null; + } + + public int count(){ + return array.length - i; + } + + public int index(){ + return i; + } + + public ArraySeq_char withMeta(IPersistentMap meta){ + return new ArraySeq_char(meta, array, i); + } + + public Object reduce(IFn f) throws Exception{ + Object ret = array[i]; + for(int x = i + 1; x < array.length; x++) + ret = f.invoke(ret, array[x]); + return ret; + } + + public Object reduce(IFn f, Object start) throws Exception{ + Object ret = f.invoke(start, array[i]); + for(int x = i + 1; x < array.length; x++) + ret = f.invoke(ret, array[x]); + return ret; + } + + public int indexOf(Object o) { + if (o instanceof Character) { + char c = ((Character) o).charValue(); + for (int j = i; j < array.length; j++) + if (c == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Character) { + char c = ((Character) o).charValue(); + for (int j = array.length - 1; j >= i; j--) + if (c == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } +} + +static public class ArraySeq_boolean extends ASeq implements IndexedSeq, IReduce{ + final boolean[] array; + final int i; + + ArraySeq_boolean(IPersistentMap meta, boolean[] array, int i){ + super(meta); + this.array = array; + this.i = i; + } + + public Object first(){ + return array[i]; + } + + public ISeq next(){ + if(i + 1 < array.length) + return new ArraySeq_boolean(meta(), array, i + 1); + return null; + } + + public int count(){ + return array.length - i; + } + + public int index(){ + return i; + } + + public ArraySeq_boolean withMeta(IPersistentMap meta){ + return new ArraySeq_boolean(meta, array, i); + } + + public Object reduce(IFn f) throws Exception{ + Object ret = array[i]; + for(int x = i + 1; x < array.length; x++) + ret = f.invoke(ret, array[x]); + return ret; + } + + public Object reduce(IFn f, Object start) throws Exception{ + Object ret = f.invoke(start, array[i]); + for(int x = i + 1; x < array.length; x++) + ret = f.invoke(ret, array[x]); + return ret; + } + + public int indexOf(Object o) { + if (o instanceof Boolean) { + boolean b = ((Boolean) o).booleanValue(); + for (int j = i; j < array.length; j++) + if (b == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = i; j < array.length; j++) + if (o.equals(array[j])) return j - i; + return -1; + } + + public int lastIndexOf(Object o) { + if (o instanceof Boolean) { + boolean b = ((Boolean) o).booleanValue(); + for (int j = array.length - 1; j >= i; j--) + if (b == array[j]) return j - i; + } + if (o == null) { + return -1; + } + for (int j = array.length - 1; j >= i; j--) + if (o.equals(array[j])) return j - i; + return -1; + } } } diff --git a/src/jvm/clojure/lang/Associative.java b/src/jvm/clojure/lang/Associative.java index 891def5f..a2399946 100644 --- a/src/jvm/clojure/lang/Associative.java +++ b/src/jvm/clojure/lang/Associative.java @@ -9,14 +9,11 @@ package clojure.lang; * the terms of this license.
* You must not remove this notice, or any other, from this software.
*/
-public interface Associative extends IPersistentCollection{
+public interface Associative extends IPersistentCollection, ILookup{
boolean containsKey(Object key);
IMapEntry entryAt(Object key);
Associative assoc(Object key, Object val);
-Object valAt(Object key);
-
-Object valAt(Object key, Object notFound);
}
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index c15d4b2f..c5c9f922 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -57,7 +57,7 @@ static final Symbol IMPORT = Symbol.create("clojure.core", "import*"); //static final Symbol INSTANCE = Symbol.create("instance?"); //static final Symbol THISFN = Symbol.create("thisfn"); -//static final Symbol CLASS = Symbol.create("class"); +static final Symbol CLASS = Symbol.create("Class"); static final Symbol NEW = Symbol.create("new"); //static final Symbol UNQUOTE = Symbol.create("unquote"); //static final Symbol UNQUOTE_SPLICING = Symbol.create("unquote-splicing"); @@ -179,6 +179,9 @@ static final public Var METHOD = Var.create(null); //null or not static final public Var IN_CATCH_FINALLY = Var.create(null); +//DynamicClassLoader +static final public Var LOADER = Var.create(); + //String static final public Var SOURCE = Var.intern(Namespace.findOrCreate(Symbol.create("clojure.core")), Symbol.create("*source-path*"), "NO_SOURCE_FILE"); @@ -207,8 +210,6 @@ static final public Var NEXT_LOCAL_NUM = Var.create(0); //Integer static final public Var RET_LOCAL_NUM = Var.create(); -//DynamicClassLoader -static final public Var LOADER = Var.create(); public enum C{ STATEMENT, //value ignored @@ -819,7 +820,9 @@ static public abstract class HostExpr implements Expr, MaybePrimitiveExpr{ Symbol sym = (Symbol) tag; if(sym.ns == null) //if ns-qualified can't be classname { - if(sym.name.equals("ints")) + if(sym.name.equals("objects")) + c = Object[].class; + else if(sym.name.equals("ints")) c = int[].class; else if(sym.name.equals("longs")) c = long[].class; @@ -2989,8 +2992,27 @@ static public class ObjExpr implements Expr{ } else if(value instanceof Class) { - gen.push(((Class) value).getName()); - gen.invokeStatic(Type.getType(Class.class), Method.getMethod("Class forName(String)")); + Class cc = (Class)value; + if(cc.isPrimitive()) + { + Type bt; + if ( cc == boolean.class ) bt = Type.getType(Boolean.class); + else if ( cc == byte.class ) bt = Type.getType(Byte.class); + else if ( cc == char.class ) bt = Type.getType(Character.class); + else if ( cc == double.class ) bt = Type.getType(Double.class); + else if ( cc == float.class ) bt = Type.getType(Float.class); + else if ( cc == int.class ) bt = Type.getType(Integer.class); + else if ( cc == long.class ) bt = Type.getType(Long.class); + else if ( cc == short.class ) bt = Type.getType(Short.class); + else throw new RuntimeException( + "Can't embed unknown primitive in code: " + value); + gen.getStatic( bt, "TYPE", Type.getType(Class.class) ); + } + else + { + gen.push(cc.getName()); + gen.invokeStatic(Type.getType(Class.class), Method.getMethod("Class forName(String)")); + } } else if(value instanceof Symbol) { @@ -4266,7 +4288,7 @@ public static Object macroexpand1(Object x) throws Exception{ Object target = RT.second(form); if(HostExpr.maybeClass(target, false) != null) { - target = RT.list(IDENTITY, target); + target = ((IObj)RT.list(IDENTITY, target)).withMeta(RT.map(RT.TAG_KEY,CLASS)); } return RT.listStar(DOT, target, meth, form.next().next()); } diff --git a/src/jvm/clojure/lang/IEditableCollection.java b/src/jvm/clojure/lang/IEditableCollection.java new file mode 100644 index 00000000..63ccb53a --- /dev/null +++ b/src/jvm/clojure/lang/IEditableCollection.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Jul 17, 2009 */ + +package clojure.lang; + +public interface IEditableCollection{ +ITransientCollection asTransient(); +} diff --git a/src/jvm/clojure/lang/ILookup.java b/src/jvm/clojure/lang/ILookup.java new file mode 100644 index 00000000..b124955d --- /dev/null +++ b/src/jvm/clojure/lang/ILookup.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Aug 2, 2009 */ + +package clojure.lang; + +public interface ILookup{ +Object valAt(Object key); + +Object valAt(Object key, Object notFound); +} diff --git a/src/jvm/clojure/lang/ITransientAssociative.java b/src/jvm/clojure/lang/ITransientAssociative.java new file mode 100644 index 00000000..a4d2655a --- /dev/null +++ b/src/jvm/clojure/lang/ITransientAssociative.java @@ -0,0 +1,18 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Jul 17, 2009 */ + +package clojure.lang; + +public interface ITransientAssociative extends ITransientCollection, ILookup{ + +ITransientAssociative assoc(Object key, Object val); +} diff --git a/src/jvm/clojure/lang/ITransientCollection.java b/src/jvm/clojure/lang/ITransientCollection.java new file mode 100644 index 00000000..0079d33b --- /dev/null +++ b/src/jvm/clojure/lang/ITransientCollection.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Jul 17, 2009 */ + +package clojure.lang; + +public interface ITransientCollection{ + +ITransientCollection conj(Object val); + +IPersistentCollection persistent(); +} diff --git a/src/jvm/clojure/lang/ITransientMap.java b/src/jvm/clojure/lang/ITransientMap.java new file mode 100644 index 00000000..6516b34c --- /dev/null +++ b/src/jvm/clojure/lang/ITransientMap.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Jul 17, 2009 */ + +package clojure.lang; + +public interface ITransientMap extends ITransientAssociative, Counted{ + +ITransientMap assoc(Object key, Object val); + +ITransientMap without(Object key); + +IPersistentMap persistent(); +} diff --git a/src/jvm/clojure/lang/ITransientSet.java b/src/jvm/clojure/lang/ITransientSet.java new file mode 100644 index 00000000..b7a369cb --- /dev/null +++ b/src/jvm/clojure/lang/ITransientSet.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Mar 3, 2008 */ + +package clojure.lang; + +public interface ITransientSet extends ITransientCollection, Counted{ + public ITransientSet disjoin(Object key) throws Exception; + public boolean contains(Object key); + public Object get(Object key); +} diff --git a/src/jvm/clojure/lang/ITransientVector.java b/src/jvm/clojure/lang/ITransientVector.java new file mode 100644 index 00000000..6311754c --- /dev/null +++ b/src/jvm/clojure/lang/ITransientVector.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Rich Hickey. All rights reserved. + * The use and distribution terms for this software are covered by the + * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) + * which can be found in the file epl-v10.html at the root of this distribution. + * By using this software in any fashion, you are agreeing to be bound by + * the terms of this license. + * You must not remove this notice, or any other, from this software. + **/ + +/* rich Jul 17, 2009 */ + +package clojure.lang; + +public interface ITransientVector extends ITransientAssociative, Indexed{ + +ITransientVector assocN(int i, Object val); + +ITransientVector pop(); +} diff --git a/src/jvm/clojure/lang/Keyword.java b/src/jvm/clojure/lang/Keyword.java index fcb814f6..890f14d7 100644 --- a/src/jvm/clojure/lang/Keyword.java +++ b/src/jvm/clojure/lang/Keyword.java @@ -12,10 +12,12 @@ package clojure.lang; +import java.io.ObjectStreamException; +import java.io.Serializable; import java.util.concurrent.ConcurrentHashMap; -public class Keyword implements IFn, Comparable, Named{ +public class Keyword implements IFn, Comparable, Named, Serializable { private static ConcurrentHashMap<Symbol, Keyword> table = new ConcurrentHashMap(); public final Symbol sym; @@ -30,6 +32 |