diff options
author | Rich Hickey <richhickey@gmail.com> | 2010-04-26 11:32:48 -0400 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2010-04-26 11:32:48 -0400 |
commit | 787938361128c2bc21ed896dd4523651b59cb420 (patch) | |
tree | 2f0642fd258cb7fdaf54e81c42ed166efb4da970 | |
parent | a5ca8243e3ea45e6387b2b00d0e9b2624d16adbf (diff) |
replace #^s with ^s
-rw-r--r-- | src/clj/clojure/core.clj | 412 | ||||
-rw-r--r-- | src/clj/clojure/core/protocols.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/core_deftype.clj | 26 | ||||
-rw-r--r-- | src/clj/clojure/core_print.clj | 88 | ||||
-rw-r--r-- | src/clj/clojure/core_proxy.clj | 58 | ||||
-rw-r--r-- | src/clj/clojure/genclass.clj | 52 | ||||
-rw-r--r-- | src/clj/clojure/gvec.clj | 60 | ||||
-rw-r--r-- | src/clj/clojure/inspector.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/main.clj | 8 | ||||
-rw-r--r-- | src/clj/clojure/parallel.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/set.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/stacktrace.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/template.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/test.clj | 12 | ||||
-rw-r--r-- | src/clj/clojure/test/junit.clj | 4 | ||||
-rw-r--r-- | src/clj/clojure/test/tap.clj | 4 | ||||
-rw-r--r-- | src/clj/clojure/walk.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/xml.clj | 8 | ||||
-rw-r--r-- | src/clj/clojure/zip.clj | 4 |
19 files changed, 375 insertions, 375 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index b2b08661..48da4fc3 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -6,7 +6,7 @@ ; the terms of this license. ; You must not remove this notice, or any other, from this software. -(ns #^{:doc "The core Clojure language." +(ns ^{:doc "The core Clojure language." :author "Rich Hickey"} clojure.core) @@ -14,12 +14,12 @@ (def unquote-splicing) (def - #^{:arglists '([& items]) + ^{:arglists '([& items]) :doc "Creates a new list containing the items."} list (. clojure.lang.PersistentList creator)) (def - #^{:arglists '([x seq]) + ^{:arglists '([x seq]) :doc "Returns a new seq where x is the first element and seq is the rest."} @@ -27,41 +27,41 @@ ;during bootstrap we don't have destructuring let, loop or fn, will redefine later (def - #^{:macro true} + ^{:macro true} let (fn* let [&form &env & decl] (cons 'let* decl))) (def - #^{:macro true} + ^{:macro true} loop (fn* loop [&form &env & decl] (cons 'loop* decl))) (def - #^{:macro true} + ^{:macro true} fn (fn* fn [&form &env & decl] - (.withMeta #^clojure.lang.IObj (cons 'fn* decl) - (.meta #^clojure.lang.IMeta &form)))) + (.withMeta ^clojure.lang.IObj (cons 'fn* decl) + (.meta ^clojure.lang.IMeta &form)))) (def - #^{:arglists '([coll]) + ^{:arglists '([coll]) :doc "Returns the first item in the collection. Calls seq on its argument. If coll is nil, returns nil."} first (fn first [coll] (. clojure.lang.RT (first coll)))) (def - #^{:arglists '([coll]) + ^{:arglists '([coll]) :tag clojure.lang.ISeq :doc "Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."} next (fn next [x] (. clojure.lang.RT (next x)))) (def - #^{:arglists '([coll]) + ^{:arglists '([coll]) :tag clojure.lang.ISeq :doc "Returns a possibly empty seq of the items after the first. Calls seq on its argument."} rest (fn rest [x] (. clojure.lang.RT (more x)))) (def - #^{:arglists '([coll x] [coll x & xs]) + ^{:arglists '([coll x] [coll x & xs]) :doc "conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."} @@ -73,32 +73,32 @@ (conj coll x))))) (def - #^{:doc "Same as (first (next x))" + ^{:doc "Same as (first (next x))" :arglists '([x])} second (fn second [x] (first (next x)))) (def - #^{:doc "Same as (first (first x))" + ^{:doc "Same as (first (first x))" :arglists '([x])} ffirst (fn ffirst [x] (first (first x)))) (def - #^{:doc "Same as (next (first x))" + ^{:doc "Same as (next (first x))" :arglists '([x])} nfirst (fn nfirst [x] (next (first x)))) (def - #^{:doc "Same as (first (next x))" + ^{:doc "Same as (first (next x))" :arglists '([x])} fnext (fn fnext [x] (first (next x)))) (def - #^{:doc "Same as (next (next x))" + ^{:doc "Same as (next (next x))" :arglists '([x])} nnext (fn nnext [x] (next (next x)))) (def - #^{:arglists '([coll]) + ^{:arglists '([coll]) :doc "Returns a seq on the collection. If the collection is empty, returns nil. (seq nil) returns nil. seq also works on Strings, native Java arrays (of reference types) and any objects @@ -107,38 +107,38 @@ seq (fn seq [coll] (. clojure.lang.RT (seq coll)))) (def - #^{:arglists '([#^Class c x]) + ^{:arglists '([^Class c x]) :doc "Evaluates x and tests if it is an instance of the class c. Returns true or false"} - instance? (fn instance? [#^Class c x] (. c (isInstance x)))) + instance? (fn instance? [^Class c x] (. c (isInstance x)))) (def - #^{:arglists '([x]) + ^{:arglists '([x]) :doc "Return true if x implements ISeq"} seq? (fn seq? [x] (instance? clojure.lang.ISeq x))) (def - #^{:arglists '([x]) + ^{:arglists '([x]) :doc "Return true if x is a Character"} char? (fn char? [x] (instance? Character x))) (def - #^{:arglists '([x]) + ^{:arglists '([x]) :doc "Return true if x is a String"} string? (fn string? [x] (instance? String x))) (def - #^{:arglists '([x]) + ^{:arglists '([x]) :doc "Return true if x implements IPersistentMap"} map? (fn map? [x] (instance? clojure.lang.IPersistentMap x))) (def - #^{:arglists '([x]) + ^{:arglists '([x]) :doc "Return true if x implements IPersistentVector "} vector? (fn vector? [x] (instance? clojure.lang.IPersistentVector x))) (def - #^{:arglists '([map key val] [map key val & kvs]) + ^{:arglists '([map key val] [map key val & kvs]) :doc "assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that @@ -154,21 +154,21 @@ ;;;;;;;;;;;;;;;;; metadata ;;;;;;;;;;;;;;;;;;;;;;;;;;; (def - #^{:arglists '([obj]) + ^{:arglists '([obj]) :doc "Returns the metadata of obj, returns nil if there is no metadata."} meta (fn meta [x] (if (instance? clojure.lang.IMeta x) - (. #^clojure.lang.IMeta x (meta))))) + (. ^clojure.lang.IMeta x (meta))))) (def - #^{:arglists '([#^clojure.lang.IObj obj m]) + ^{:arglists '([^clojure.lang.IObj obj m]) :doc "Returns an object of the same type and value as obj, with map m as its metadata."} - with-meta (fn with-meta [#^clojure.lang.IObj x m] + with-meta (fn with-meta [^clojure.lang.IObj x m] (. x (withMeta m)))) (def - #^{:private true} + ^{:private true} sigs (fn [fdecl] (let [asig @@ -193,7 +193,7 @@ (def - #^{:arglists '([coll]) + ^{:arglists '([coll]) :doc "Return the last item in coll, in linear time"} last (fn last [s] (if (next s) @@ -201,7 +201,7 @@ (first s)))) (def - #^{:arglists '([coll]) + ^{:arglists '([coll]) :doc "Return a seq of all but the last item in coll, in linear time"} butlast (fn butlast [s] (loop [ret [] s s] @@ -211,7 +211,7 @@ (def - #^{:doc "Same as (def name (fn [params* ] exprs*)) or (def + ^{:doc "Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata" :arglists '([name doc-string? attr-map? [params*] body] @@ -256,7 +256,7 @@ (defn cast "Throws a ClassCastException if x is not a c, else returns x." - [#^Class c x] + [^Class c x] (. c (cast x))) (defn to-array @@ -322,7 +322,7 @@ (def - #^{:doc "Like defn, but the resulting function name is declared as a + ^{:doc "Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called." :arglists '([name doc-string? attr-map? [params*] body] @@ -399,14 +399,14 @@ one arg, returns the concatenation of the str values of the args." {:tag String} ([] "") - ([#^Object x] + ([^Object x] (if (nil? x) "" (. x (toString)))) ([x & ys] - ((fn [#^StringBuilder sb more] + ((fn [^StringBuilder sb more] (if more (recur (. sb (append (str (first more)))) (next more)) (str sb))) - (new StringBuilder #^String (str x)) ys))) + (new StringBuilder ^String (str x)) ys))) (defn symbol? @@ -449,8 +449,8 @@ in the keyword strings, it will be added automatically." {:tag clojure.lang.Keyword} ([name] (cond (keyword? name) name - (symbol? name) (clojure.lang.Keyword/intern #^clojure.lang.Symbol name) - (string? name) (clojure.lang.Keyword/intern #^String name))) + (symbol? name) (clojure.lang.Keyword/intern ^clojure.lang.Symbol name) + (string? name) (clojure.lang.Keyword/intern ^String name))) ([ns name] (clojure.lang.Keyword/intern ns name))) (defn spread @@ -474,15 +474,15 @@ (defn apply "Applies fn f to the argument list formed by prepending args to argseq." {:arglists '([f args* argseq])} - ([#^clojure.lang.IFn f args] + ([^clojure.lang.IFn f args] (. f (applyTo (seq args)))) - ([#^clojure.lang.IFn f x args] + ([^clojure.lang.IFn f x args] (. f (applyTo (list* x args)))) - ([#^clojure.lang.IFn f x y args] + ([^clojure.lang.IFn f x y args] (. f (applyTo (list* x y args)))) - ([#^clojure.lang.IFn f x y z args] + ([^clojure.lang.IFn f x y z args] (. f (applyTo (list* x y z args)))) - ([#^clojure.lang.IFn f a b c d & args] + ([^clojure.lang.IFn f a b c d & args] (. f (applyTo (cons a (cons b (cons c (cons d (spread args))))))))) (defn vary-meta @@ -497,24 +497,24 @@ is called, and will cache the result and return it on all subsequent seq calls." [& body] - (list 'new 'clojure.lang.LazySeq (list* '#^{:once true} fn* [] body))) + (list 'new 'clojure.lang.LazySeq (list* '^{:once true} fn* [] body))) -(defn #^clojure.lang.ChunkBuffer chunk-buffer [capacity] +(defn ^clojure.lang.ChunkBuffer chunk-buffer [capacity] (clojure.lang.ChunkBuffer. capacity)) -(defn chunk-append [#^clojure.lang.ChunkBuffer b x] +(defn chunk-append [^clojure.lang.ChunkBuffer b x] (.add b x)) -(defn chunk [#^clojure.lang.ChunkBuffer b] +(defn chunk [^clojure.lang.ChunkBuffer b] (.chunk b)) -(defn #^clojure.lang.IChunk chunk-first [#^clojure.lang.IChunkedSeq s] +(defn ^clojure.lang.IChunk chunk-first [^clojure.lang.IChunkedSeq s] (.chunkedFirst s)) -(defn #^clojure.lang.ISeq chunk-rest [#^clojure.lang.IChunkedSeq s] +(defn ^clojure.lang.ISeq chunk-rest [^clojure.lang.IChunkedSeq s] (.chunkedMore s)) -(defn #^clojure.lang.ISeq chunk-next [#^clojure.lang.IChunkedSeq s] +(defn ^clojure.lang.ISeq chunk-next [^clojure.lang.IChunkedSeq s] (.chunkedNext s)) (defn chunk-cons [chunk rest] @@ -557,7 +557,7 @@ will cache the result and return it on all subsequent force calls." [& body] - (list 'new 'clojure.lang.Delay (list* `#^{:once true} fn* [] body))) + (list 'new 'clojure.lang.Delay (list* `^{:once true} fn* [] body))) (defn delay? "returns true if x is a Delay created with delay" @@ -1040,7 +1040,7 @@ "disj[oin]. Returns a new set of the same (hashed/sorted) type, that does not contain key(s)." ([set] set) - ([#^clojure.lang.IPersistentSet set key] + ([^clojure.lang.IPersistentSet set key] (. set (disjoin key))) ([set key & ks] (let [ret (disj set key)] @@ -1075,30 +1075,30 @@ (defn key "Returns the key of the map entry." - [#^java.util.Map$Entry e] + [^java.util.Map$Entry e] (. e (getKey))) (defn val "Returns the value in the map entry." - [#^java.util.Map$Entry e] + [^java.util.Map$Entry e] (. e (getValue))) (defn rseq "Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil" - [#^clojure.lang.Reversible rev] + [^clojure.lang.Reversible rev] (. rev (rseq))) (defn name "Returns the name String of a symbol or keyword." {:tag String} - [#^clojure.lang.Named x] + [^clojure.lang.Named x] (. x (getName))) (defn namespace "Returns the namespace String of a symbol or keyword, or nil if not present." {:tag String} - [#^clojure.lang.Named x] + [^clojure.lang.Named x] (. x (getNamespace))) (defmacro locking @@ -1201,36 +1201,36 @@ (defn remove-all-methods "Removes all of the methods of multimethod." - [#^clojure.lang.MultiFn multifn] + [^clojure.lang.MultiFn multifn] (.reset multifn)) (defn remove-method "Removes the method of multimethod associated with dispatch-value." - [#^clojure.lang.MultiFn multifn dispatch-val] + [^clojure.lang.MultiFn multifn dispatch-val] (. multifn removeMethod dispatch-val)) (defn prefer-method "Causes the multimethod to prefer matches of dispatch-val-x over dispatch-val-y when there is a conflict" - [#^clojure.lang.MultiFn multifn dispatch-val-x dispatch-val-y] + [^clojure.lang.MultiFn multifn dispatch-val-x dispatch-val-y] (. multifn preferMethod dispatch-val-x dispatch-val-y)) (defn methods "Given a multimethod, returns a map of dispatch values -> dispatch fns" - [#^clojure.lang.MultiFn multifn] (.getMethodTable multifn)) + [^clojure.lang.MultiFn multifn] (.getMethodTable multifn)) (defn get-method "Given a multimethod and a dispatch value, returns the dispatch fn that would apply to that value, or nil if none apply and no default" - [#^clojure.lang.MultiFn multifn dispatch-val] (.getMethod multifn dispatch-val)) + [^clojure.lang.MultiFn multifn dispatch-val] (.getMethod multifn dispatch-val)) (defn prefers "Given a multimethod, returns a map of preferred value -> set of other values" - [#^clojure.lang.MultiFn multifn] (.getPreferTable multifn)) + [^clojure.lang.MultiFn multifn] (.getPreferTable multifn)) ;;;;;;;;; var stuff -(defmacro #^{:private true} assert-args [fnname & pairs] +(defmacro ^{:private true} assert-args [fnname & pairs] `(do (when-not ~(first pairs) (throw (IllegalArgumentException. ~(str fnname " requires " (second pairs))))) @@ -1365,8 +1365,8 @@ [sym] (. clojure.lang.Var (find sym))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Refs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defn #^{:private true} - setup-reference [#^clojure.lang.ARef r options] +(defn ^{:private true} + setup-reference [^clojure.lang.ARef r options] (let [opts (apply hash-map options)] (when (:meta opts) (.resetMeta r (:meta opts))) @@ -1412,7 +1412,7 @@ will be set to the value of: (apply action-fn state-of-agent args)" - [#^clojure.lang.Agent a f & args] + [^clojure.lang.Agent a f & args] (. a (dispatch f args false))) (defn send-off @@ -1421,7 +1421,7 @@ the agent will be set to the value of: (apply action-fn state-of-agent args)" - [#^clojure.lang.Agent a f & args] + [^clojure.lang.Agent a f & args] (. a (dispatch f args true))) (defn release-pending-sends @@ -1448,19 +1448,19 @@ set!s. Keys must be unique per reference, and can be used to remove the watch with remove-watch, but are otherwise considered opaque by the watch mechanism." - [#^clojure.lang.IRef reference key fn] (.addWatch reference key fn)) + [^clojure.lang.IRef reference key fn] (.addWatch reference key fn)) (defn remove-watch "Alpha - subject to change. Removes a watch (set by add-watch) from a reference" - [#^clojure.lang.IRef reference key] + [^clojure.lang.IRef reference key] (.removeWatch reference key)) (defn agent-error "Returns the exception thrown during an asynchronous action of the agent if the agent is failed. Returns nil if the agent is not failed." - [#^clojure.lang.Agent a] (.getError a)) + [^clojure.lang.Agent a] (.getError a)) (defn restart-agent "When an agent is failed, changes the agent state to new-state and @@ -1472,7 +1472,7 @@ agent will remain failed with its old state and error. Watchers, if any, will NOT be notified of the new state. Throws an exception if the agent is not failed." - [#^clojure.lang.Agent a, new-state & options] + [^clojure.lang.Agent a, new-state & options] (let [opts (apply hash-map options)] (.restart a new-state (if (:clear-actions opts) true false)))) @@ -1481,13 +1481,13 @@ being run by the agent throws an exception or doesn't pass the validator fn, handler-fn will be called with two arguments: the agent and the exception." - [#^clojure.lang.Agent a, handler-fn] + [^clojure.lang.Agent a, handler-fn] (.setErrorHandler a handler-fn)) (defn error-handler "Returns the error-handler of agent a, or nil if there is none. See set-error-handler!" - [#^clojure.lang.Agent a] + [^clojure.lang.Agent a] (.getErrorHandler a)) (defn set-error-mode! @@ -1502,12 +1502,12 @@ accepting new 'send' and 'send-off' actions, and any previously queued actions will be held until a 'restart-agent'. Deref will still work, returning the state of the agent before the error." - [#^clojure.lang.Agent a, mode-keyword] + [^clojure.lang.Agent a, mode-keyword] (.setErrorMode a mode-keyword)) (defn error-mode "Returns the error-mode of agent a. See set-error-mode!" - [#^clojure.lang.Agent a] + [^clojure.lang.Agent a] (.getErrorMode a)) (defn agent-errors @@ -1522,7 +1522,7 @@ "DEPRECATED: Use 'restart-agent' instead. Clears any exceptions thrown during asynchronous actions of the agent, allowing subsequent actions to occur." - [#^clojure.lang.Agent a] (restart-agent a (.deref a))) + [^clojure.lang.Agent a] (restart-agent a (.deref a))) (defn shutdown-agents "Initiates a shutdown of the thread pools that back the agent @@ -1555,7 +1555,7 @@ with :max-history." ([x] (new clojure.lang.Ref x)) ([x & options] - (let [r #^clojure.lang.Ref (setup-reference (ref x) options) + (let [r ^clojure.lang.Ref (setup-reference (ref x) options) opts (apply hash-map options)] (when (:max-history opts) (.setMaxHistory r (:max-history opts))) @@ -1570,7 +1570,7 @@ or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation not complete" - [#^clojure.lang.IDeref ref] (.deref ref)) + [^clojure.lang.IDeref ref] (.deref ref)) (defn atom "Creates and returns an Atom with an initial value of x and zero or @@ -1593,21 +1593,21 @@ (apply f current-value-of-atom args). Note that f may be called multiple times, and thus should be free of side effects. Returns the value that was swapped in." - ([#^clojure.lang.Atom atom f] (.swap atom f)) - ([#^clojure.lang.Atom atom f x] (.swap atom f x)) - ([#^clojure.lang.Atom atom f x y] (.swap atom f x y)) - ([#^clojure.lang.Atom atom f x y & args] (.swap atom f x y args))) + ([^clojure.lang.Atom atom f] (.swap atom f)) + ([^clojure.lang.Atom atom f x] (.swap atom f x)) + ([^clojure.lang.Atom atom f x y] (.swap atom f x y)) + ([^clojure.lang.Atom atom f x y & args] (.swap atom f x y args))) (defn compare-and-set! "Atomically sets the value of atom to newval if and only if the current value of the atom is identical to oldval. Returns true if set happened, else false" - [#^clojure.lang.Atom atom oldval newval] (.compareAndSet atom oldval newval)) + [^clojure.lang.Atom atom oldval newval] (.compareAndSet atom oldval newval)) (defn reset! "Sets the value of atom to newval without regard for the current value. Returns newval." - [#^clojure.lang.Atom atom newval] (.reset atom newval)) + [^clojure.lang.Atom atom newval] (.reset atom newval)) (defn set-validator! "Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a @@ -1616,11 +1616,11 @@ validator-fn should return false or throw an exception. If the current state (root value if var) is not acceptable to the new validator, an exception will be thrown and the validator will not be changed." - [#^clojure.lang.IRef iref validator-fn] (. iref (setValidator validator-fn))) + [^clojure.lang.IRef iref validator-fn] (. iref (setValidator validator-fn))) (defn get-validator "Gets the validator-fn for a var/ref/agent/atom." - [#^clojure.lang.IRef iref] (. iref (getValidator))) + [^clojure.lang.IRef iref] (. iref (getValidator))) (defn alter-meta! "Atomically sets the metadata for a namespace/var/ref/agent/atom to be: @@ -1628,11 +1628,11 @@ (apply f its-current-meta args) f must be free of side-effects" - [#^clojure.lang.IReference iref f & args] (.alterMeta iref f args)) + [^clojure.lang.IReference iref f & args] (.alterMeta iref f args)) (defn reset-meta! "Atomically resets the metadata for a namespace/var/ref/agent/atom" - [#^clojure.lang.IReference iref metadata-map] (.resetMeta iref metadata-map)) + [^clojure.lang.IReference iref metadata-map] (.resetMeta iref metadata-map)) (defn commute "Must be called in a transaction. Sets the in-transaction-value of @@ -1650,7 +1650,7 @@ last-one-in-wins behavior. commute allows for more concurrency than ref-set." - [#^clojure.lang.Ref ref fun & args] + [^clojure.lang.Ref ref fun & args] (. ref (commute fun args))) (defn alter @@ -1660,39 +1660,39 @@ (apply fun in-transaction-value-of-ref args) and returns the in-transaction-value of ref." - [#^clojure.lang.Ref ref fun & args] + [^clojure.lang.Ref ref fun & args] (. ref (alter fun args))) (defn ref-set "Must be called in a transaction. Sets the value of ref. Returns val." - [#^clojure.lang.Ref ref val] + [^clojure.lang.Ref ref val] (. ref (set val))) (defn ref-history-count "Returns the history count of a ref" - [#^clojure.lang.Ref ref] + [^clojure.lang.Ref ref] (.getHistoryCount ref)) (defn ref-min-history "Gets the min-history of a ref, or sets it and returns the ref" - ([#^clojure.lang.Ref ref] + ([^clojure.lang.Ref ref] (.getMinHistory ref)) - ([#^clojure.lang.Ref ref n] + ([^clojure.lang.Ref ref n] (.setMinHistory ref n))) (defn ref-max-history "Gets the max-history of a ref, or sets it and returns the ref" - ([#^clojure.lang.Ref ref] + ([^clojure.lang.Ref ref] (.getMaxHistory ref)) - ([#^clojure.lang.Ref ref n] + ([^clojure.lang.Ref ref n] (.setMaxHistory ref n))) (defn ensure "Must be called in a transaction. Protects the ref from modification by other transactions. Returns the in-transaction-value of ref. Allows for more concurrency than (ref-set ref @ref)" - [#^clojure.lang.Ref ref] + [^clojure.lang.Ref ref] (. ref (touch)) (. ref (deref))) @@ -1821,7 +1821,7 @@ :else false)) (def - #^{:tag Boolean + ^{:tag Boolean :doc "Returns false if (pred x) is logical true for every x in coll, else true." :arglists '([pred coll])} @@ -1837,7 +1837,7 @@ (or (pred (first coll)) (recur pred (next coll))))) (def - #^{:tag Boolean + ^{:tag Boolean :doc "Returns false if (pred x) is logical true for any x in coll, else true." :arglists '([pred coll])} @@ -2073,7 +2073,7 @@ (defn line-seq "Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader." - [#^java.io.BufferedReader rdr] + [^java.io.BufferedReader rdr] (when-let [line (.readLine rdr)] (cons line (lazy-seq (line-seq rdr))))) @@ -2089,7 +2089,7 @@ implement java.util.Comparator." ([coll] (sort compare coll)) - ([#^java.util.Comparator comp coll] + ([^java.util.Comparator comp coll] (if (seq coll) (let [a (to-array coll)] (. java.util.Arrays (sort a comp)) @@ -2103,7 +2103,7 @@ implement java.util.Comparator." ([keyfn coll] (sort-by keyfn compare coll)) - ([keyfn #^java.util.Comparator comp coll] + ([keyfn ^java.util.Comparator comp coll] (sort (fn [x y] (. comp (compare (keyfn x) (keyfn y)))) coll))) (defn partition @@ -2233,7 +2233,7 @@ (send agent count-down)) (. latch (await))))) -(defn await1 [#^clojure.lang.Agent a] +(defn await1 [^clojure.lang.Agent a] (when (pos? (.getQueueCount a)) (await a)) a) @@ -2307,13 +2307,13 @@ ([type aseq] (clojure.lang.RT/seqToTypedArray type (seq aseq)))) -(defn #^{:private true} +(defn ^{:private true} array [& items] (into-array items)) -(defn #^Class class +(defn ^Class class "Returns the Class of x" - [#^Object x] (if (nil? x) x (. x (getClass)))) + [^Object x] (if (nil? x) x (. x (getClass)))) (defn type "Returns the :type metadata of x, or its Class if none" @@ -2330,31 +2330,31 @@ "Coerce to long" {:tag Long :inline (fn [x] `(. clojure.lang.RT (longCast ~x)))} - [#^Number x] (. x (longValue))) + [^Number x] (. x (longValue))) (defn float "Coerce to float" {:tag Float :inline (fn [x] `(. clojure.lang.RT (floatCast ~x)))} - [#^Number x] (. x (floatValue))) + [^Number x] (. x (floatValue))) (defn double "Coerce to double" {:tag Double :inline (fn [x] `(. clojure.lang.RT (doubleCast ~x)))} - [#^Number x] (. x (doubleValue))) + [^Number x] (. x (doubleValue))) (defn short "Coerce to short" {:tag Short :inline (fn [x] `(. clojure.lang.RT (shortCast ~x)))} - [#^Number x] (. x (shortValue))) + [^Number x] (. x (shortValue))) (defn byte "Coerce to byte" {:tag Byte :inline (fn [x] `(. clojure.lang.RT (byteCast ~x)))} - [#^Number x] (. x (byteValue))) + [^Number x] (. x (byteValue))) (defn char "Coerce to char" @@ -2398,13 +2398,13 @@ "Returns the numerator part of a Ratio." {:tag BigInteger} [r] - (.numerator #^clojure.lang.Ratio r)) + (.numerator ^clojure.lang.Ratio r)) (defn denominator "Returns the denominator part of a Ratio." {:tag BigInteger} [r] - (.denominator #^clojure.lang.Ratio r)) + (.denominator ^clojure.lang.Ratio r)) (defn decimal? "Returns true if n is a BigDecimal" @@ -2425,8 +2425,8 @@ {:tag BigInteger} [x] (cond (instance? BigInteger x) x - (decimal? x) (.toBigInteger #^BigDecimal x) - (ratio? x) (.bigIntegerValue #^clojure.lang.Ratio x) + (decimal? x) (.toBigInteger ^BigDecimal x) + (ratio? x) (.bigIntegerValue ^clojure.lang.Ratio x) (number? x) (BigInteger/valueOf (long x)) :else (BigInteger. x))) @@ -2437,11 +2437,11 @@ (decimal? x) x (float? x) (. BigDecimal valueOf (double x)) (ratio? x) (/ (BigDecimal. (.numerator x)) (.denominator x)) - (instance? BigInteger x) (BigDecimal. #^BigInteger x) + (instance? BigInteger x) (BigDecimal. ^BigInteger x) (number? x) (BigDecimal/valueOf (long x)) :else (BigDecimal. x))) -(def #^{:private true} print-initialized false) +(def ^{:private true} print-initialized false) (defmulti print-method (fn [x writer] (type x))) (defmulti print-dup (fn [x writer] (class x))) @@ -2521,8 +2521,8 @@ "Reads the next line from stream that is the current value of *in* ." [] (if (instance? clojure.lang.LineNumberingPushbackReader *in*) - (.readLine #^clojure.lang.LineNumberingPushbackReader *in*) - (.readLine #^java.io.BufferedReader *in*))) + (.readLine ^clojure.lang.LineNumberingPushbackReader *in*) + (.readLine ^java.io.BufferedReader *in*))) (defn read-string "Reads one object from the string s" @@ -2631,7 +2631,7 @@ (apply aset (aget array idx) idx2 idxv))) (defmacro - #^{:private true} + ^{:private true} def-aset [name method coerce] `(defn ~name {:arglists '([~'array ~'idx ~'val] [~'array ~'idx ~'idx2 & ~'idxv])} @@ -2642,35 +2642,35 @@ (apply ~name (aget array# idx#) idx2# idxv#)))) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of int. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of int. Returns val."} aset-int setInt int) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of long. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of long. Returns val."} aset-long setLong long) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of boolean. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of boolean. Returns val."} aset-boolean setBoolean boolean) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of float. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of float. Returns val."} aset-float setFloat float) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of double. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of double. Returns val."} aset-double setDouble double) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of short. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of short. Returns val."} aset-short setShort short) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of byte. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of byte. Returns val."} aset-byte setByte byte) (def-aset - #^{:doc "Sets the value at the index/indices. Works on arrays of char. Returns val."} + ^{:doc "Sets the value at the index/indices. Works on arrays of char. Returns val."} aset-char setChar char) (defn make-array @@ -2679,11 +2679,11 @@ Class objects can be obtained by using their imported or fully-qualified name. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE." - ([#^Class type len] + ([^Class type len] (. Array (newInstance type (int len)))) - ([#^Class type dim & more-dims] + ([^Class type dim & more-dims] (let [dims (cons dim more-dims) - #^"[I" dimarray (make-array (. Integer TYPE) (count dims))] + ^"[I" dimarray (make-array (. Integer TYPE) (count dims))] (dotimes [i (alength dimarray)] (aset-int dimarray i (nth dims i))) (. Array (newInstance type dimarray))))) @@ -2693,7 +2693,7 @@ containing the contents of coll, which can be any Collection of any Collection." {:tag "[[Ljava.lang.Object;"} - [#^java.util.Collection coll] + [^java.util.Collection coll] (let [ret (make-array (. Class (forName "[Ljava.lang.Object;")) (. coll (size)))] (loop [i 0 xs (seq coll)] (when xs @@ -2766,9 +2766,9 @@ (defn set "Returns a set of the distinct elements of coll." - [coll] (clojure.lang.PersistentHashSet/create #^clojure.lang.ISeq (seq coll))) + [coll] (clojure.lang.PersistentHashSet/create ^clojure.lang.ISeq (seq coll))) -(defn #^{:private true} +(defn ^{:private true} filter-key [keyfn pred amap] (loop [ret {} es (seq amap)] (if es @@ -2796,7 +2796,7 @@ "Returns a sequence of all namespaces." [] (clojure.lang.Namespace/all)) -(defn #^clojure.lang.Namespace the-ns +(defn ^clojure.lang.Namespace the-ns "If passed a namespace, returns it. Else, when passed a symbol, returns the namespace named by it, throwing an exception if not found." @@ -2828,7 +2828,7 @@ "Returns a map of the public intern mappings for the namespace." [ns] (let [ns (the-ns ns)] - (filter-key val (fn [#^clojure.lang.Var v] (and (instance? clojure.lang.Var v) + (filter-key val (fn [^clojure.lang.Var v] (and (instance? clojure.lang.Var v) (= ns (.ns v)) (.isPublic v))) (ns-map ns)))) @@ -2871,7 +2871,7 @@ "Returns a map of the refer mappings for the namespace." [ns] (let [ns (the-ns ns)] - |