Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

get rid of checked exceptions

  • Loading branch information...
commit 8fda34e4c77cac079b711da59d5fe49b74605553 1 parent 0245f15
Rich Hickey authored March 21, 2011

Showing 58 changed files with 2,066 additions and 1,926 deletions. Show diff stats Hide diff stats

  1. 52  src/jvm/clojure/lang/AFn.java
  2. 4  src/jvm/clojure/lang/AFunction.java
  3. 4  src/jvm/clojure/lang/AMapEntry.java
  4. 4  src/jvm/clojure/lang/APersistentMap.java
  5. 2  src/jvm/clojure/lang/APersistentSet.java
  6. 6  src/jvm/clojure/lang/APersistentVector.java
  7. 6  src/jvm/clojure/lang/ARef.java
  8. 2  src/jvm/clojure/lang/AReference.java
  9. 516  src/jvm/clojure/lang/ASeq.java
  10. 4  src/jvm/clojure/lang/ATransientMap.java
  11. 6  src/jvm/clojure/lang/ATransientSet.java
  12. 12  src/jvm/clojure/lang/Agent.java
  13. 2  src/jvm/clojure/lang/ArrayChunk.java
  14. 32  src/jvm/clojure/lang/ArraySeq.java
  15. 8  src/jvm/clojure/lang/Atom.java
  16. 2  src/jvm/clojure/lang/Compile.java
  17. 525  src/jvm/clojure/lang/Compiler.java
  18. 4  src/jvm/clojure/lang/Delay.java
  19. 19  src/jvm/clojure/lang/FnLoaderThunk.java
  20. 2  src/jvm/clojure/lang/IBlockingDeref.java
  21. 2  src/jvm/clojure/lang/IChunk.java
  22. 6  src/jvm/clojure/lang/IChunkedSeq.java
  23. 2  src/jvm/clojure/lang/IDeref.java
  24. 46  src/jvm/clojure/lang/IFn.java
  25. 46  src/jvm/clojure/lang/IPersistentMap.java
  26. 2  src/jvm/clojure/lang/IPersistentSet.java
  27. 4  src/jvm/clojure/lang/IReduce.java
  28. 2  src/jvm/clojure/lang/IReference.java
  29. 2  src/jvm/clojure/lang/ITransientSet.java
  30. 50  src/jvm/clojure/lang/Keyword.java
  31. 2  src/jvm/clojure/lang/LazySeq.java
  32. 186  src/jvm/clojure/lang/LispReader.java
  33. 14  src/jvm/clojure/lang/LockingTransaction.java
  34. 66  src/jvm/clojure/lang/MultiFn.java
  35. 4  src/jvm/clojure/lang/Namespace.java
  36. 16  src/jvm/clojure/lang/Numbers.java
  37. 4  src/jvm/clojure/lang/PersistentArrayMap.java
  38. 4  src/jvm/clojure/lang/PersistentHashMap.java
  39. 2  src/jvm/clojure/lang/PersistentHashSet.java
  40. 6  src/jvm/clojure/lang/PersistentList.java
  41. 12  src/jvm/clojure/lang/PersistentStructMap.java
  42. 6  src/jvm/clojure/lang/PersistentTreeMap.java
  43. 4  src/jvm/clojure/lang/PersistentTreeSet.java
  44. 4  src/jvm/clojure/lang/PersistentVector.java
  45. 87  src/jvm/clojure/lang/RT.java
  46. 4  src/jvm/clojure/lang/Range.java
  47. 58  src/jvm/clojure/lang/Ref.java
  48. 110  src/jvm/clojure/lang/Reflector.java
  49. 2  src/jvm/clojure/lang/Repl.java
  50. 1,906  src/jvm/clojure/lang/RestFn.java
  51. 2  src/jvm/clojure/lang/Reversible.java
  52. 2  src/jvm/clojure/lang/Script.java
  53. 4  src/jvm/clojure/lang/Settable.java
  54. 4  src/jvm/clojure/lang/Symbol.java
  55. 10  src/jvm/clojure/lang/TransactionalHashMap.java
  56. 14  src/jvm/clojure/lang/Util.java
  57. 79  src/jvm/clojure/lang/Var.java
  58. 6  src/jvm/clojure/main.java
52  src/jvm/clojure/lang/AFn.java
@@ -14,7 +14,7 @@
14 14
 
15 15
 public abstract class AFn implements IFn {
16 16
 
17  
-public Object call() throws Exception{
  17
+public Object call() {
18 18
 	return invoke();
19 19
 }
20 20
 
@@ -25,116 +25,116 @@ public void run(){
25 25
 		}
26 26
 	catch(Exception e)
27 27
 		{
28  
-		throw new RuntimeException(e);
  28
+		throw Util.runtimeException(e);
29 29
 		}
30 30
 }
31 31
 
32 32
 
33 33
 
34  
-public Object invoke() throws Exception{
  34
+public Object invoke() {
35 35
 	return throwArity(0);
36 36
 }
37 37
 
38  
-public Object invoke(Object arg1) throws Exception{
  38
+public Object invoke(Object arg1) {
39 39
 	return throwArity(1);
40 40
 }
41 41
 
42  
-public Object invoke(Object arg1, Object arg2) throws Exception{
  42
+public Object invoke(Object arg1, Object arg2) {
43 43
 	return throwArity(2);
44 44
 }
45 45
 
46  
-public Object invoke(Object arg1, Object arg2, Object arg3) throws Exception{
  46
+public Object invoke(Object arg1, Object arg2, Object arg3) {
47 47
 	return throwArity(3);
48 48
 }
49 49
 
50  
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4) throws Exception{
  50
+public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4) {
51 51
 	return throwArity(4);
52 52
 }
53 53
 
54  
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws Exception{
  54
+public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
55 55
 	return throwArity(5);
56 56
 }
57 57
 
58  
-public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) throws Exception{
  58
+public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
59 59
 	return throwArity(6);
60 60
 }
61 61
 
62 62
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
63  
-		throws Exception{
  63
+		{
64 64
 	return throwArity(7);
65 65
 }
66 66
 
67 67
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
68  
-                     Object arg8) throws Exception{
  68
+                     Object arg8) {
69 69
 	return throwArity(8);
70 70
 }
71 71
 
72 72
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
73  
-                     Object arg8, Object arg9) throws Exception{
  73
+                     Object arg8, Object arg9) {
74 74
 	return throwArity(9);
75 75
 }
76 76
 
77 77
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
78  
-                     Object arg8, Object arg9, Object arg10) throws Exception{
  78
+                     Object arg8, Object arg9, Object arg10) {
79 79
 	return throwArity(10);
80 80
 }
81 81
 
82 82
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
83  
-                     Object arg8, Object arg9, Object arg10, Object arg11) throws Exception{
  83
+                     Object arg8, Object arg9, Object arg10, Object arg11) {
84 84
 	return throwArity(11);
85 85
 }
86 86
 
87 87
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
88  
-                     Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) throws Exception{
  88
+                     Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) {
89 89
 	return throwArity(12);
90 90
 }
91 91
 
92 92
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
93 93
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13)
94  
-		throws Exception{
  94
+		{
95 95
 	return throwArity(13);
96 96
 }
97 97
 
98 98
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
99 99
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14)
100  
-		throws Exception{
  100
+		{
101 101
 	return throwArity(14);
102 102
 }
103 103
 
104 104
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
105 105
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
106  
-                     Object arg15) throws Exception{
  106
+                     Object arg15) {
107 107
 	return throwArity(15);
108 108
 }
109 109
 
110 110
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
111 111
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
112  
-                     Object arg15, Object arg16) throws Exception{
  112
+                     Object arg15, Object arg16) {
113 113
 	return throwArity(16);
114 114
 }
115 115
 
116 116
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
117 117
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
118  
-                     Object arg15, Object arg16, Object arg17) throws Exception{
  118
+                     Object arg15, Object arg16, Object arg17) {
119 119
 	return throwArity(17);
120 120
 }
121 121
 
122 122
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
123 123
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
124  
-                     Object arg15, Object arg16, Object arg17, Object arg18) throws Exception{
  124
+                     Object arg15, Object arg16, Object arg17, Object arg18) {
125 125
 	return throwArity(18);
126 126
 }
127 127
 
128 128
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
129 129
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
130  
-                     Object arg15, Object arg16, Object arg17, Object arg18, Object arg19) throws Exception{
  130
+                     Object arg15, Object arg16, Object arg17, Object arg18, Object arg19) {
131 131
 	return throwArity(19);
132 132
 }
133 133
 
134 134
 public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7,
135 135
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
136 136
                      Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20)
137  
-		throws Exception{
  137
+		{
138 138
 	return throwArity(20);
139 139
 }
140 140
 
@@ -143,15 +143,15 @@ public Object invoke(Object arg1, Object arg2, Object arg3, Object arg4, Object
143 143
                      Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14,
144 144
                      Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20,
145 145
                      Object... args)
146  
-		throws Exception{
  146
+		{
147 147
 	return throwArity(21);
148 148
 }
149 149
 
150  
-public Object applyTo(ISeq arglist) throws Exception{
  150
+public Object applyTo(ISeq arglist) {
151 151
 	return applyToHelper(this, Util.ret1(arglist,arglist = null));
152 152
 }
153 153
 
154  
-static public Object applyToHelper(IFn ifn, ISeq arglist) throws Exception{
  154
+static public Object applyToHelper(IFn ifn, ISeq arglist) {
155 155
 	switch(RT.boundedLength(arglist, 20))
156 156
 		{
157 157
 		case 0:
4  src/jvm/clojure/lang/AFunction.java
@@ -25,7 +25,7 @@ public IPersistentMap meta(){
25 25
 
26 26
 public IObj withMeta(final IPersistentMap meta){
27 27
 	return new RestFn(){
28  
-		protected Object doInvoke(Object args) throws Exception{
  28
+		protected Object doInvoke(Object args) {
29 29
 			return AFunction.this.applyTo((ISeq) args);
30 30
 		}
31 31
 
@@ -60,7 +60,7 @@ public int compare(Object o1, Object o2){
60 60
 		}
61 61
 	catch(Exception e)
62 62
 		{
63  
-		throw new RuntimeException(e);
  63
+		throw Util.runtimeException(e);
64 64
 		}
65 65
 }
66 66
 }
4  src/jvm/clojure/lang/AMapEntry.java
@@ -78,7 +78,7 @@ public String toString(){
78 78
 	catch(Exception e)
79 79
 		{
80 80
 		//checked exceptions stink!
81  
-		throw new RuntimeException(e);
  81
+		throw Util.runtimeException(e);
82 82
 		}
83 83
 	return sw.toString();
84 84
 }
@@ -141,7 +141,7 @@ public Object peek(){
141 141
 }
142 142
 
143 143
 
144  
-public ISeq rseq() throws Exception{
  144
+public ISeq rseq() {
145 145
 	return asVector().rseq();
146 146
 }
147 147
 */
4  src/jvm/clojure/lang/APersistentMap.java
@@ -173,11 +173,11 @@ public ValSeq withMeta(IPersistentMap meta){
173 173
 }
174 174
 
175 175
 
176  
-public Object invoke(Object arg1) throws Exception{
  176
+public Object invoke(Object arg1) {
177 177
 	return valAt(arg1);
178 178
 }
179 179
 
180  
-public Object invoke(Object arg1, Object notFound) throws Exception{
  180
+public Object invoke(Object arg1, Object notFound) {
181 181
 	return valAt(arg1, notFound);
182 182
 }
183 183
 
2  src/jvm/clojure/lang/APersistentSet.java
@@ -45,7 +45,7 @@ public ISeq seq(){
45 45
 	return RT.keys(impl);
46 46
 }
47 47
 
48  
-public Object invoke(Object arg1) throws Exception{
  48
+public Object invoke(Object arg1) {
49 49
 	return get(arg1);
50 50
 }
51 51
 
6  src/jvm/clojure/lang/APersistentVector.java
@@ -244,7 +244,7 @@ public boolean addAll(int i, Collection c){
244 244
 }
245 245
 
246 246
 
247  
-public Object invoke(Object arg1) throws Exception{
  247
+public Object invoke(Object arg1) {
248 248
 	if(Util.isInteger(arg1))
249 249
 		return nth(((Number) arg1).intValue());
250 250
 	throw new IllegalArgumentException("Key must be integer");
@@ -445,14 +445,14 @@ public int count(){
445 445
 		return new APersistentVector.Seq(meta, v, i);
446 446
 	}
447 447
 
448  
-	public Object reduce(IFn f) throws Exception{
  448
+	public Object reduce(IFn f) {
449 449
 		Object ret = v.nth(i);
450 450
 		for(int x = i + 1; x < v.count(); x++)
451 451
 			ret = f.invoke(ret, v.nth(x));
452 452
 		return ret;
453 453
 	}
454 454
 
455  
-	public Object reduce(IFn f, Object start) throws Exception{
  455
+	public Object reduce(IFn f, Object start) {
456 456
 		Object ret = f.invoke(start, v.nth(i));
457 457
 		for(int x = i + 1; x < v.count(); x++)
458 458
 			ret = f.invoke(ret, v.nth(x));
6  src/jvm/clojure/lang/ARef.java
@@ -53,7 +53,7 @@ public void setValidator(IFn vf){
53 53
 		}
54 54
 	catch(Exception e)
55 55
 		{
56  
-		throw new RuntimeException(e);
  56
+		throw Util.runtimeException(e);
57 57
 		}
58 58
 	validator = vf;
59 59
 }
@@ -78,7 +78,7 @@ synchronized public IRef removeWatch(Object key){
78 78
 		}
79 79
 	catch(Exception e)
80 80
 		{
81  
-		throw new RuntimeException(e);
  81
+		throw Util.runtimeException(e);
82 82
 		}
83 83
 
84 84
 	return this;
@@ -99,7 +99,7 @@ public void notifyWatches(Object oldval, Object newval){
99 99
 				}
100 100
 			catch(Exception e1)
101 101
 				{
102  
-				throw new RuntimeException(e1);
  102
+				throw Util.runtimeException(e1);
103 103
 				}
104 104
 			}
105 105
 		}
2  src/jvm/clojure/lang/AReference.java
@@ -27,7 +27,7 @@ synchronized public IPersistentMap meta() {
27 27
         return _meta;
28 28
     }
29 29
 
30  
-    synchronized public IPersistentMap alterMeta(IFn alter, ISeq args) throws Exception {
  30
+    synchronized public IPersistentMap alterMeta(IFn alter, ISeq args)  {
31 31
         _meta = (IPersistentMap) alter.applyTo(new Cons(_meta, args));
32 32
         return _meta;
33 33
     }
516  src/jvm/clojure/lang/ASeq.java
... ...
@@ -1,259 +1,259 @@
1  
-/**
2  
- *   Copyright (c) Rich Hickey. All rights reserved.
3  
- *   The use and distribution terms for this software are covered by the
4  
- *   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5  
- *   which can be found in the file epl-v10.html at the root of this distribution.
6  
- *   By using this software in any fashion, you are agreeing to be bound by
7  
- * 	 the terms of this license.
8  
- *   You must not remove this notice, or any other, from this software.
9  
- **/
10  
-
11  
-package clojure.lang;
12  
-
13  
-import java.io.Serializable;
14  
-import java.util.*;
15  
-
  1
+/**
  2
+ *   Copyright (c) Rich Hickey. All rights reserved.
  3
+ *   The use and distribution terms for this software are covered by the
  4
+ *   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
  5
+ *   which can be found in the file epl-v10.html at the root of this distribution.
  6
+ *   By using this software in any fashion, you are agreeing to be bound by
  7
+ * 	 the terms of this license.
  8
+ *   You must not remove this notice, or any other, from this software.
  9
+ **/
  10
+
  11
+package clojure.lang;
  12
+
  13
+import java.io.Serializable;
  14
+import java.util.*;
  15
+
16 16
 public abstract class ASeq extends Obj implements ISeq, Sequential, List, Serializable {
17  
-transient int _hash = -1;
18  
-
19  
-public String toString(){
20  
-	return RT.printString(this);
21  
-}
22  
-
23  
-public IPersistentCollection empty(){
24  
-	return PersistentList.EMPTY;
25  
-}
26  
-
27  
-protected ASeq(IPersistentMap meta){
28  
-	super(meta);
29  
-}
30  
-
31  
-
32  
-protected ASeq(){
33  
-}
34  
-
35  
-public boolean equiv(Object obj){
36  
-
37  
-	if(!(obj instanceof Sequential || obj instanceof List))
38  
-		return false;
39  
-	ISeq ms = RT.seq(obj);
40  
-	for(ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
41  
-		{
42  
-		if(ms == null || !Util.equiv(s.first(), ms.first()))
43  
-			return false;
44  
-		}
45  
-	return ms == null;
46  
-
47  
-}
48  
-
49  
-public boolean equals(Object obj){
50  
-	if(this == obj) return true;
51  
-	if(!(obj instanceof Sequential || obj instanceof List))
52  
-		return false;
53  
-	ISeq ms = RT.seq(obj);
54  
-	for(ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
55  
-		{
56  
-		if(ms == null || !Util.equals(s.first(), ms.first()))
57  
-			return false;
58  
-		}
59  
-	return ms == null;
60  
-
61  
-}
62  
-
63  
-public int hashCode(){
64  
-	if(_hash == -1)
65  
-		{
66  
-		int hash = 1;
67  
-		for(ISeq s = seq(); s != null; s = s.next())
68  
-			{
69  
-			hash = 31 * hash + (s.first() == null ? 0 : s.first().hashCode());
70  
-			}
71  
-		this._hash = hash;
72  
-		}
73  
-	return _hash;
74  
-}
75  
-
76  
-
77  
-//public Object reduce(IFn f) throws Exception{
78  
-//	Object ret = first();
79  
-//	for(ISeq s = rest(); s != null; s = s.rest())
80  
-//		ret = f.invoke(ret, s.first());
81  
-//	return ret;
82  
-//}
83  
-//
84  
-//public Object reduce(IFn f, Object start) throws Exception{
85  
-//	Object ret = f.invoke(start, first());
86  
-//	for(ISeq s = rest(); s != null; s = s.rest())
87  
-//		ret = f.invoke(ret, s.first());
88  
-//	return ret;
89  
-//}
90  
-
91  
-//public Object peek(){
92  
-//	return first();
93  
-//}
94  
-//
95  
-//public IPersistentList pop(){
96  
-//	return rest();
97  
-//}
98  
-
99  
-public int count(){
100  
-	int i = 1;
101  
-	for(ISeq s = next(); s != null; s = s.next(), i++)
102  
-		if(s instanceof Counted)
103  
-			return i + s.count();
104  
-	return i;
105  
-}
106  
-
107  
-final public ISeq seq(){
108  
-	return this;
109  
-}
110  
-
111  
-public ISeq cons(Object o){
112  
-	return new Cons(o, this);
113  
-}
114  
-
115  
-public ISeq more(){
116  
-    ISeq s = next();
117  
-    if(s == null)
118  
-        return PersistentList.EMPTY;
119  
-    return s;
120  
-}
121  
-
122  
-//final public ISeq rest(){
123  
-//    Seqable m = more();
124  
-//    if(m == null)
125  
-//        return null;
126  
-//    return m.seq();
127  
-//}
128  
-
129  
-// java.util.Collection implementation
130  
-
131  
-public Object[] toArray(){
132  
-	return RT.seqToArray(seq());
133  
-}
134  
-
135  
-public boolean add(Object o){
136  
-	throw new UnsupportedOperationException();
137  
-}
138  
-
139  
-public boolean remove(Object o){
140  
-	throw new UnsupportedOperationException();
141  
-}
142  
-
143  
-public boolean addAll(Collection c){
144  
-	throw new UnsupportedOperationException();
145  
-}
146  
-
147  
-public void clear(){
148  
-	throw new UnsupportedOperationException();
149  
-}
150  
-
151  
-public boolean retainAll(Collection c){
152  
-	throw new UnsupportedOperationException();
153  
-}
154  
-
155  
-public boolean removeAll(Collection c){
156  
-	throw new UnsupportedOperationException();
157  
-}
158  
-
159  
-public boolean containsAll(Collection c){
160  
-	for(Object o : c)
161  
-		{
162  
-		if(!contains(o))
163  
-			return false;
164  
-		}
165  
-	return true;
166  
-}
167  
-
168  
-public Object[] toArray(Object[] a){
169  
-	if(a.length >= count())
170  
-		{
171  
-		ISeq s = seq();
172  
-		for(int i = 0; s != null; ++i, s = s.next())
173  
-			{
174  
-			a[i] = s.first();
175  
-			}
176  
-		if(a.length > count())
177  
-			a[count()] = null;
178  
-		return a;
179  
-		}
180  
-	else
181  
-		return toArray();
182  
-}
183  
-
184  
-public int size(){
185  
-	return count();
186  
-}
187  
-
188  
-public boolean isEmpty(){
189  
-	return seq() == null;
190  
-}
191  
-
192  
-public boolean contains(Object o){
193  
-	for(ISeq s = seq(); s != null; s = s.next())
194  
-		{
195  
-		if(Util.equiv(s.first(), o))
196  
-			return true;
197  
-		}
198  
-	return false;
199  
-}
200  
-
201  
-
202  
-public Iterator iterator(){
203  
-	return new SeqIterator(this);
204  
-}
205  
-
206  
-
207  
-
208  
-//////////// List stuff /////////////////
209  
-private List reify(){
210  
-	return Collections.unmodifiableList(new ArrayList(this));
211  
-}
212  
-
213  
-public List subList(int fromIndex, int toIndex){
214  
-	return reify().subList(fromIndex, toIndex);
215  
-}
216  
-
217  
-public Object set(int index, Object element){
218  
-	throw new UnsupportedOperationException();
219  
-}
220  
-
221  
-public Object remove(int index){
222  
-	throw new UnsupportedOperationException();
223  
-}
224  
-
225  
-public int indexOf(Object o){
226  
-	ISeq s = seq();
227  
-	for(int i = 0; s != null; s = s.next(), i++)
228  
-		{
229  
-		if(Util.equiv(s.first(), o))
230  
-			return i;
231  
-		}
232  
-	return -1;
233  
-}
234  
-
235  
-public int lastIndexOf(Object o){
236  
-	return reify().lastIndexOf(o);
237  
-}
238  
-
239  
-public ListIterator listIterator(){
240  
-	return reify().listIterator();
241  
-}
242  
-
243  
-public ListIterator listIterator(int index){
244  
-	return reify().listIterator(index);
245  
-}
246  
-
247  
-public Object get(int index){
248  
-	return RT.nth(this, index);
249  
-}
250  
-
251  
-public void add(int index, Object element){
252  
-	throw new UnsupportedOperationException();
253  
-}
254  
-
255  
-public boolean addAll(int index, Collection c){
256  
-	throw new UnsupportedOperationException();
257  
-}
258  
-
259  
-}
  17
+transient int _hash = -1;
  18
+
  19
+public String toString(){
  20
+	return RT.printString(this);
  21
+}
  22
+
  23
+public IPersistentCollection empty(){
  24
+	return PersistentList.EMPTY;
  25
+}
  26
+
  27
+protected ASeq(IPersistentMap meta){
  28
+	super(meta);
  29
+}
  30
+
  31
+
  32
+protected ASeq(){
  33
+}
  34
+
  35
+public boolean equiv(Object obj){
  36
+
  37
+	if(!(obj instanceof Sequential || obj instanceof List))
  38
+		return false;
  39
+	ISeq ms = RT.seq(obj);
  40
+	for(ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
  41
+		{
  42
+		if(ms == null || !Util.equiv(s.first(), ms.first()))
  43
+			return false;
  44
+		}
  45
+	return ms == null;
  46
+
  47
+}
  48
+
  49
+public boolean equals(Object obj){
  50
+	if(this == obj) return true;
  51
+	if(!(obj instanceof Sequential || obj instanceof List))
  52
+		return false;
  53
+	ISeq ms = RT.seq(obj);
  54
+	for(ISeq s = seq(); s != null; s = s.next(), ms = ms.next())
  55
+		{
  56
+		if(ms == null || !Util.equals(s.first(), ms.first()))
  57
+			return false;
  58
+		}
  59
+	return ms == null;
  60
+
  61
+}
  62
+
  63
+public int hashCode(){
  64
+	if(_hash == -1)
  65
+		{
  66
+		int hash = 1;
  67
+		for(ISeq s = seq(); s != null; s = s.next())
  68
+			{
  69
+			hash = 31 * hash + (s.first() == null ? 0 : s.first().hashCode());
  70
+			}
  71
+		this._hash = hash;
  72
+		}
  73
+	return _hash;
  74
+}
  75
+
  76
+
  77
+//public Object reduce(IFn f) {
  78
+//	Object ret = first();
  79
+//	for(ISeq s = rest(); s != null; s = s.rest())
  80
+//		ret = f.invoke(ret, s.first());
  81
+//	return ret;
  82
+//}
  83
+//
  84
+//public Object reduce(IFn f, Object start) {
  85
+//	Object ret = f.invoke(start, first());
  86
+//	for(ISeq s = rest(); s != null; s = s.rest())
  87
+//		ret = f.invoke(ret, s.first());
  88
+//	return ret;
  89
+//}
  90
+
  91
+//public Object peek(){
  92
+//	return first();
  93
+//}
  94
+//
  95
+//public IPersistentList pop(){
  96
+//	return rest();
  97
+//}
  98
+
  99
+public int count(){
  100
+	int i = 1;
  101
+	for(ISeq s = next(); s != null; s = s.next(), i++)
  102
+		if(s instanceof Counted)
  103
+			return i + s.count();
  104
+	return i;
  105
+}
  106
+
  107
+final public ISeq seq(){
  108
+	return this;
  109
+}
  110
+
  111
+public ISeq cons(Object o){
  112
+	return new Cons(o, this);
  113
+}
  114
+
  115
+public ISeq more(){
  116
+    ISeq s = next();
  117
+    if(s == null)
  118
+        return PersistentList.EMPTY;
  119
+    return s;
  120
+}
  121
+
  122
+//final public ISeq rest(){
  123
+//    Seqable m = more();
  124
+//    if(m == null)
  125
+//        return null;
  126
+//    return m.seq();
  127
+//}
  128
+
  129
+// java.util.Collection implementation
  130
+
  131
+public Object[] toArray(){
  132
+	return RT.seqToArray(seq());
  133
+}
  134
+
  135
+public boolean add(Object o){
  136
+	throw new UnsupportedOperationException();
  137
+}
  138
+
  139
+public boolean remove(Object o){
  140
+	throw new UnsupportedOperationException();
  141
+}
  142
+
  143
+public boolean addAll(Collection c){
  144
+	throw new UnsupportedOperationException();
  145
+}
  146
+
  147
+public void clear(){
  148
+	throw new UnsupportedOperationException();
  149
+}
  150
+
  151
+public boolean retainAll(Collection c){
  152
+	throw new UnsupportedOperationException();
  153
+}
  154
+
  155
+public boolean removeAll(Collection c){
  156
+	throw new UnsupportedOperationException();
  157
+}
  158
+
  159
+public boolean containsAll(Collection c){
  160
+	for(Object o : c)
  161
+		{
  162
+		if(!contains(o))
  163
+			return false;
  164
+		}
  165
+	return true;
  166
+}
  167
+
  168
+public Object[] toArray(Object[] a){
  169
+	if(a.length >= count())
  170
+		{
  171
+		ISeq s = seq();
  172
+		for(int i = 0; s != null; ++i, s = s.next())
  173
+			{
  174
+			a[i] = s.first();
  175
+			}
  176
+		if(a.length > count())
  177
+			a[count()] = null;
  178
+		return a;
  179
+		}
  180
+	else
  181
+		return toArray();
  182
+}
  183
+
  184
+public int size(){
  185
+	return count();
  186
+}
  187
+
  188
+public boolean isEmpty(){
  189
+	return seq() == null;
  190
+}
  191
+
  192
+public boolean contains(Object o){
  193
+	for(ISeq s = seq(); s != null; s = s.next())
  194
+		{
  195
+		if(Util.equiv(s.first(), o))
  196
+			return true;
  197
+		}
  198
+	return false;
  199
+}
  200
+
  201
+
  202
+public Iterator iterator(){
  203
+	return new SeqIterator(this);
  204
+}
  205
+
  206
+
  207
+
  208
+//////////// List stuff /////////////////
  209
+private List reify(){
  210
+	return Collections.unmodifiableList(new ArrayList(this));
  211
+}
  212
+
  213
+public List subList(int fromIndex, int toIndex){
  214
+	return reify().subList(fromIndex, toIndex);
  215
+}
  216
+
  217
+public Object set(int index, Object element){
  218
+	throw new UnsupportedOperationException();
  219
+}
  220
+
  221
+public Object remove(int index){
  222
+	throw new UnsupportedOperationException();
  223
+}
  224
+
  225
+public int indexOf(Object o){
  226
+	ISeq s = seq();
  227
+	for(int i = 0; s != null; s = s.next(), i++)
  228
+		{
  229
+		if(Util.equiv(s.first(), o))
  230
+			return i;
  231
+		}
  232
+	return -1;
  233
+}
  234
+
  235
+public int lastIndexOf(Object o){
  236
+	return reify().lastIndexOf(o);
  237
+}
  238
+
  239
+public ListIterator listIterator(){
  240
+	return reify().listIterator();
  241
+}
  242
+
  243
+public ListIterator listIterator(int index){
  244
+	return reify().listIterator(index);
  245
+}
  246
+
  247
+public Object get(int index){
  248
+	return RT.nth(this, index);
  249
+}
  250
+
  251
+public void add(int index, Object element){
  252
+	throw new UnsupportedOperationException();
  253
+}
  254
+
  255
+public boolean addAll(int index, Collection c){
  256
+	throw new UnsupportedOperationException();
  257
+}
  258
+
  259
+}
4  src/jvm/clojure/lang/ATransientMap.java
@@ -47,11 +47,11 @@ else if(o instanceof IPersistentVector)
47 47
 		return ret;
48 48
 	}
49 49
 
50  
-	public final Object invoke(Object arg1) throws Exception{
  50
+	public final Object invoke(Object arg1) {
51 51
 		return valAt(arg1);
52 52
 	}
53 53
 
54  
-	public final Object invoke(Object arg1, Object notFound) throws Exception{
  54
+	public final Object invoke(Object arg1, Object notFound) {
55 55
 		return valAt(arg1, notFound);
56 56
 	}
57 57
 
6  src/jvm/clojure/lang/ATransientSet.java
@@ -33,7 +33,7 @@ public boolean contains(Object key) {
33 33
 		return this != impl.valAt(key, this);
34 34
 	}
35 35
 
36  
-	public ITransientSet disjoin(Object key) throws Exception {
  36
+	public ITransientSet disjoin(Object key)  {
37 37
 		ITransientMap m = impl.without(key);
38 38
 		if (m != impl) this.impl = m;
39 39
 		return this;
@@ -43,11 +43,11 @@ public Object get(Object key) {
43 43
 		return impl.valAt(key);
44 44
 	}
45 45
 
46  
-	public Object invoke(Object key, Object notFound) throws Exception {
  46
+	public Object invoke(Object key, Object notFound)  {
47 47
 		return impl.valAt(key, notFound);
48 48
 	}
49 49
 
50  
-	public Object invoke(Object key) throws Exception {
  50
+	public Object invoke(Object key)  {
51 51
 		return impl.valAt(key);	
52 52
 	}
53 53
 	
12  src/jvm/clojure/lang/Agent.java
@@ -166,23 +166,23 @@ public void run(){
166 166
 	}
167 167
 }
168 168
 
169  
-public Agent(Object state) throws Exception{
  169
+public Agent(Object state) {
170 170
 	this(state,null);
171 171
 }
172 172
 
173  
-public Agent(Object state, IPersistentMap meta) throws Exception {
  173
+public Agent(Object state, IPersistentMap meta)  {
174 174
     super(meta);
175 175
     setState(state);
176 176
 }
177 177
 
178  
-boolean setState(Object newState) throws Exception{
  178
+boolean setState(Object newState) {
179 179
 	validate(newState);
180 180
 	boolean ret = state != newState;
181 181
 	state = newState;
182 182
 	return ret;
183 183
 }
184 184
 
185  
-public Object deref() throws Exception{
  185
+public Object deref() {
186 186
 	return state;
187 187
 }
188 188
 
@@ -209,7 +209,7 @@ public IFn getErrorHandler(){
209 209
 synchronized public Object restart(Object newState, boolean clearActions){
210 210
 	if(getError() == null)
211 211
 		{
212  
-		throw new RuntimeException("Agent does not need a restart");
  212
+		throw Util.runtimeException("Agent does not need a restart");
213 213
 		}
214 214
 	validate(newState);
215 215
 	state = newState;
@@ -237,7 +237,7 @@ public Object dispatch(IFn fn, ISeq args, boolean solo) {
237 237
 	Throwable error = getError();
238 238
 	if(error != null)
239 239
 		{
240  
-		throw new RuntimeException("Agent is failed, needs restart", error);
  240
+		throw Util.runtimeException("Agent is failed, needs restart", error);
241 241
 		}
242 242
 	Action action = new Action(this, fn, args, solo);
243 243
 	dispatchAction(action);
2  src/jvm/clojure/lang/ArrayChunk.java
@@ -54,7 +54,7 @@ public IChunk dropFirst(){
54 54
 	return new ArrayChunk(array, off + 1, end);
55 55
 }
56 56
 
57  
-public Object reduce(IFn f, Object start) throws Exception{
  57
+public Object reduce(IFn f, Object start) {
58 58
 		Object ret = f.invoke(start, array[off]);
59 59
 		for(int x = off + 1; x < end; x++)
60 60
 			ret = f.invoke(ret, array[x]);
32  src/jvm/clojure/lang/ArraySeq.java
@@ -102,7 +102,7 @@ public ArraySeq withMeta(IPersistentMap meta){
102 102
 	return new ArraySeq(meta, array, i);
103 103
 }
104 104
 
105  
-public Object reduce(IFn f) throws Exception{
  105
+public Object reduce(IFn f) {
106 106
 	if(oa != null)
107 107
 		{
108 108
 		Object ret = oa[i];
@@ -117,7 +117,7 @@ public Object reduce(IFn f) throws Exception{
117 117
 	return ret;
118 118
 }
119 119
 
120  
-public Object reduce(IFn f, Object start) throws Exception{
  120
+public Object reduce(IFn f, Object start) {
121 121
 	if(oa != null)
122 122
 		{
123 123
 		Object ret = f.invoke(start, oa[i]);
@@ -198,14 +198,14 @@ public ArraySeq_int withMeta(IPersistentMap meta){
198 198
 		return new ArraySeq_int(meta, array, i);
199 199
 	}
200 200
 
201  
-	public Object reduce(IFn f) throws Exception{
  201
+	public Object reduce(IFn f) {
202 202
 		Object ret = array[i];
203 203
 		for(int x = i + 1; x < array.length; x++)
204 204
 			ret = f.invoke(ret, array[x]);
205 205
 		return ret;
206 206
 	}
207 207
 
208  
-	public Object reduce(IFn f, Object start) throws Exception{
  208
+	public Object reduce(IFn f, Object start) {
209 209
 		Object ret = f.invoke(start, array[i]);
210 210
 		for(int x = i + 1; x < array.length; x++)
211 211
 			ret = f.invoke(ret, array[x]);
@@ -266,14 +266,14 @@ public ArraySeq_float withMeta(IPersistentMap meta){
266 266
 		return new ArraySeq_float(meta, array, i);
267 267
 	}
268 268
 
269  
-	public Object reduce(IFn f) throws Exception{
  269
+	public Object reduce(IFn f) {
270 270
 		Object ret = Numbers.num(array[i]);
271 271
 		for(int x = i + 1; x < array.length; x++)
272 272
 			ret = f.invoke(ret, Numbers.num(array[x]));
273 273
 		return ret;
274 274
 	}
275 275
 
276  
-	public Object reduce(IFn f, Object start) throws Exception{
  276
+	public Object reduce(IFn f, Object start) {
277 277
 		Object ret = f.invoke(start, Numbers.num(array[i]));
278 278
 		for(int x = i + 1; x < array.length; x++)
279 279
 			ret = f.invoke(ret, Numbers.num(array[x]));
@@ -331,14 +331,14 @@ public ArraySeq_double withMeta(IPersistentMap meta){
331 331
 		return new ArraySeq_double(meta, array, i);
332 332
 	}
333 333
 
334  
-	public Object reduce(IFn f) throws Exception{
  334
+	public Object reduce(IFn f) {
335 335
 		Object ret = array[i];
336 336
 		for(int x = i + 1; x < array.length; x++)
337 337
 			ret = f.invoke(ret, array[x]);
338 338
 		return ret;
339 339
 	}
340 340
 
341  
-	public Object reduce(IFn f, Object start) throws Exception{
  341
+	public Object reduce(IFn f, Object start) {
342 342
 		Object ret = f.invoke(start, array[i]);
343 343
 		for(int x = i + 1; x < array.length; x++)
344 344
 			ret = f.invoke(ret, array[x]);
@@ -398,14 +398,14 @@ public ArraySeq_long withMeta(IPersistentMap meta){
398 398
 		return new ArraySeq_long(meta, array, i);
399 399
 	}
400 400
 
401  
-	public Object reduce(IFn f) throws Exception{
  401
+	public Object reduce(IFn f) {
402 402
 		Object ret = Numbers.num(array[i]);
403 403
 		for(int x = i + 1; x < array.length; x++)
404 404
 			ret = f.invoke(ret, Numbers.num(array[x]));
405 405
 		return ret;
406 406
 	}
407 407
 
408  
-	public Object reduce(IFn f, Object start) throws Exception{
  408
+	public Object reduce(IFn f, Object start) {
409 409
 		Object ret = f.invoke(start, Numbers.num(array[i]));
410 410
 		for(int x = i + 1; x < array.length; x++)
411 411
 			ret = f.invoke(ret, Numbers.num(array[x]));
@@ -465,14 +465,14 @@ public ArraySeq_byte withMeta(IPersistentMap meta){
465 465
 		return new ArraySeq_byte(meta, array, i);
466 466
 	}
467 467
 
468  
-	public Object reduce(IFn f) throws Exception{
  468
+	public Object reduce(IFn f) {
469 469
 		Object ret = array[i];
470 470
 		for(int x = i + 1; x < array.length; x++)
471 471
 			ret = f.invoke(ret, array[x]);
472 472
 		return ret;
473 473
 	}
474 474
 
475  
-	public Object reduce(IFn f, Object start) throws Exception{
  475
+	public Object reduce(IFn f, Object start) {
476 476
 		Object ret = f.invoke(start, array[i]);
477 477
 		for(int x = i + 1; x < array.length; x++)
478 478
 			ret = f.invoke(ret, array[x]);
@@ -540,14 +540,14 @@ public ArraySeq_char withMeta(IPersistentMap meta){
540 540
 		return new ArraySeq_char(meta, array, i);
541 541
 	}
542 542
 
543  
-	public Object reduce(IFn f) throws Exception{
  543
+	public Object reduce(IFn f) {
544 544
 		Object ret = array[i];
545 545
 		for(int x = i + 1; x < array.length; x++)
546 546
 			ret = f.invoke(ret, array[x]);
547 547
 		return ret;
548 548
 	}
549 549
 
550  
-	public Object reduce(IFn f, Object start) throws Exception{
  550
+	public Object reduce(IFn f, Object start) {
551 551
 		Object ret = f.invoke(start, array[i]);
552 552
 		for(int x = i + 1; x < array.length; x++)
553 553
 			ret = f.invoke(ret, array[x]);
@@ -615,14 +615,14 @@ public ArraySeq_boolean withMeta(IPersistentMap meta){
615 615
 		return new ArraySeq_boolean(meta, array, i);
616 616
 	}
617 617
 
618  
-	public Object reduce(IFn f) throws Exception{
  618
+	public Object reduce(IFn f) {
619 619
 		Object ret = array[i];
620 620
 		for(int x = i + 1; x < array.length; x++)
621 621
 			ret = f.invoke(ret, array[x]);
622 622
 		return ret;
623 623
 	}
624 624
 
625  
-	public Object reduce(IFn f, Object start) throws Exception{
  625
+	public Object reduce(IFn f, Object start) {
626 626
 		Object ret = f.invoke(start, array[i]);
627 627
 		for(int x = i + 1; x < array.length; x++)
628 628
 			ret = f.invoke(ret, array[x]);
8  src/jvm/clojure/lang/Atom.java
@@ -30,7 +30,7 @@ public Object deref(){