diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-02-22 14:36:31 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-02-22 14:36:31 +0000 |
commit | 14500dafbc4effea7aa6a15c68d29429a439fa0e (patch) | |
tree | f8e74111647225217650cdd3db933e595536ba4d /src | |
parent | 9671d467aca8b7c9cae17e40ba3ff81a611fbe22 (diff) |
completed docs
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.clj | 47 | ||||
-rw-r--r-- | src/jvm/clojure/lang/RT.java | 12 |
2 files changed, 40 insertions, 19 deletions
diff --git a/src/boot.clj b/src/boot.clj index cd535d05..ac49bbb8 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -44,12 +44,25 @@ first (fn [coll] (. clojure.lang.RT (first coll)))) If there are no more items, returns nil."} rest (fn [x] (. clojure.lang.RT (rest x)))) -(def second (fn [x] (. clojure.lang.RT (second x)))) +(def + #^{:doc "Same as (first (rest x))"} +second (fn [x] (first (rest x)))) + +(def + #^{:doc "Same as (first (first x))"} +ffirst (fn [x] (first (first x)))) + +(def + #^{:doc "Same as (rest (first x))"} +rfirst (fn [x] (rest (first x)))) + +(def + #^{:doc "Same as (first (rest x))"} +frest (fn [x] (first (rest x)))) -(def ffirst (fn [x] (first (first x)))) -(def rfirst (fn [x] (rest (first x)))) -(def frest (fn [x] (first (rest x)))) -(def rrest (fn [x] (rest (rest x)))) +(def + #^{:doc "Same as (rest (rest x))"} +rrest (fn [x] (rest (rest x)))) (def #^{:arglists '([coll]) @@ -1263,28 +1276,36 @@ time [expr] ret#)) -(defn #^Integer int [x] +(defn #^{:tag Integer :doc "Coerce to int"} +int [x] (. clojure.lang.RT (intCast x))) -(defn #^Long long [#^Number x] +(defn #^{:tag Long :doc "Coerce to long"} +long [#^Number x] (. x (longValue))) -(defn #^Float float [#^Number x] +(defn #^{:tag Float :doc "Coerce to float"} +float [#^Number x] (. x (floatValue))) -(defn #^Double double [#^Number x] +(defn #^{:tag Double :doc "Coerce to double"} +double [#^Number x] (. x (doubleValue))) -(defn #^Short short [#^Number x] +(defn #^{:tag Short :doc "Coerce to short"} +short [#^Number x] (. x (shortValue))) -(defn #^Byte byte [#^Number x] +(defn #^{:tag Byte :doc "Coerce to byte"} +byte [#^Number x] (. x (byteValue))) -(defn #^Character char [x] +(defn #^{:tag Character :doc "Coerce to char"} +char [x] (. clojure.lang.RT (charCast x))) -(defn #^Boolean boolean [x] +(defn #^{:tag Boolean :doc "Coerce to boolean"} +boolean [x] (if x true false)) (import '(java.lang.reflect Array)) diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java index 22185176..c35bdedb 100644 --- a/src/jvm/clojure/lang/RT.java +++ b/src/jvm/clojure/lang/RT.java @@ -194,12 +194,12 @@ static Var v; v = Var.intern(CLOJURE_NS, IN_NAMESPACE, inNamespace); v.setMeta(map(dockw, "Sets *ns* to the namespace named by the symbol, creating it if needed.")); - Var.intern(CLOJURE_NS, LOAD_FILE, - new AFn(){ - public Object invoke(Object arg1) throws Exception{ - return Compiler.loadFile((String) arg1); - } - }); + v = Var.intern(CLOJURE_NS, LOAD_FILE, + new AFn(){ + public Object invoke(Object arg1) throws Exception{ + return Compiler.loadFile((String) arg1); + } + }); v.setMeta(map(dockw, "Sequentially read and evaluate the set of forms contained in the file.")); v = Var.intern(CLOJURE_NS, IDENTICAL, new AFn(){ |