summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2007-12-02 20:25:00 +0000
committerRich Hickey <richhickey@gmail.com>2007-12-02 20:25:00 +0000
commitd647fbb3dc2027e837077cd94aaa9b2ffe3689eb (patch)
tree39f2547abd5ecab201d27f04ac667f77649364a8 /src
parent139ddd146f2a272b7ddda397f54b501ff499c643 (diff)
new Ref system, (list) returns ()
Diffstat (limited to 'src')
-rw-r--r--src/boot.clj10
-rw-r--r--src/jvm/clojure/lang/IRef.java6
-rw-r--r--src/jvm/clojure/lang/Ref.java2
-rw-r--r--src/jvm/clojure/lang/Var.java4
4 files changed, 10 insertions, 12 deletions
diff --git a/src/boot.clj b/src/boot.clj
index 72c39b12..50ba5ff3 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -8,7 +8,8 @@
(in-namespace 'clojure)
-(def list (fn [& args] args))
+(def list (fn [& args] (if args args '())))
+
(def cons (fn [x seq] (. clojure.lang.RT (cons x seq))))
(def conj (fn [coll x] (. clojure.lang.RT (conj coll x))))
@@ -370,9 +371,12 @@
(defn deref [#^clojure.lang.Ref ref]
(. ref (get)))
-(defn commute [#^clojure.lang.Ref ref fun & args]
+(defn commute [#^clojure.lang.TRef ref fun & args]
(. ref (commute fun args)))
+(defn send [#^clojure.lang.IRef ref fun & args]
+ (. ref (send fun args)))
+
(defn alter [#^clojure.lang.Ref ref fun & args]
(. ref (alter fun args)))
@@ -779,7 +783,7 @@
rseq sym name namespace locking .. ->
defmulti defmethod remove-method
binding find-var
- tref deref commute alter set ensure sync
+ tref deref commute alter set ensure sync send
iref iref-of iref-errors clear-iref-errors
reduce reverse comp appl
every not-every any not-any
diff --git a/src/jvm/clojure/lang/IRef.java b/src/jvm/clojure/lang/IRef.java
index e9d8417f..e9acfa57 100644
--- a/src/jvm/clojure/lang/IRef.java
+++ b/src/jvm/clojure/lang/IRef.java
@@ -133,7 +133,7 @@ public Object alter(IFn fn, ISeq args) throws Exception{
if(trans != null)
throw new Exception("Cannot alter an IRef in a transaction");
if(inAlter.get() != null)
- throw new Exception("Cannot nest alters, use commute");
+ throw new Exception("Cannot nest alters, use send");
try
{
@@ -148,7 +148,7 @@ public Object alter(IFn fn, ISeq args) throws Exception{
return this;
}
-public Object commute(IFn fn, ISeq args) throws Exception{
+public Object send(IFn fn, ISeq args) throws Exception{
if(errors != null)
{
throw new Exception("IRef has errors", (Exception) RT.first(errors));
@@ -176,7 +176,7 @@ public Object set(Object val) throws Exception{
if(trans != null)
throw new Exception("Cannot set an IRef in a transaction");
if(inAlter.get() != null)
- throw new Exception("Cannot nest alters, use commute");
+ throw new Exception("Cannot nest alters, use send");
setState(val);
return val;
}
diff --git a/src/jvm/clojure/lang/Ref.java b/src/jvm/clojure/lang/Ref.java
index 4d81efed..b5c2b6bd 100644
--- a/src/jvm/clojure/lang/Ref.java
+++ b/src/jvm/clojure/lang/Ref.java
@@ -18,7 +18,5 @@ Object get() throws Exception;
Object alter(IFn fn, ISeq args) throws Exception;
-Object commute(IFn fn, ISeq args) throws Exception;
-
Object set(Object val) throws Exception;
}
diff --git a/src/jvm/clojure/lang/Var.java b/src/jvm/clojure/lang/Var.java
index ac020867..feb2fd95 100644
--- a/src/jvm/clojure/lang/Var.java
+++ b/src/jvm/clojure/lang/Var.java
@@ -133,10 +133,6 @@ public Object alter(IFn fn, ISeq args) throws Exception{
return this;
}
-public Object commute(IFn fn, ISeq args) throws Exception{
- return alter(fn,args);
-}
-
public Object set(Object val){
Box b = getThreadBinding();
if(b != null)