Permalink
Browse files

Update for current Clojure.

  • Loading branch information...
mmcgrana committed Sep 6, 2009
1 parent 8224a9b commit 6e4a67f37f876b1abfdae252620ea526c8e1951f
Showing 638 changed files with 6,732 additions and 1,338 deletions.
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -41,6 +41,7 @@
#doc-items {
margin-left: 17.5em;
+ /* position: fixed; */
}
#doc-items div.doc-item {
@@ -1,6 +1,9 @@
-<div class="doc-item" id="doc-1000"><h2 class="doc-item-name">alter-meta!<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">alter-meta!</span> iref f &amp; args)</li></ul><div class="var-docstring"><p>Atomically sets the metadata for a namespace/var/ref/agent/atom to be:</p><p>(apply f its-current-meta args)</p><p>f must be free of side-effects</p></div><div class="var-source"><pre>; core.clj:1350
-(defn alter-meta!
- [#^clojure.lang.IReference iref f &amp; args] (.alterMeta iref f args))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1000"><h2 class="doc-item-name">separate<span class="namespace">(clojure.contrib.seq-utils)</span></h2><ul class="var-arglists"><li>(<span class="var-name">separate</span> f s)</li></ul><div class="var-docstring"><p>Returns a vector:
+ [ (filter f s), (filter (complement f) s) ]</p></div><div class="var-source"><pre>; clojure/contrib/seq_utils.clj:40
+(defn separate
+ [ (filter f s), (filter (complement f) s) ]&quot;
+ [f s]
+ [(filter f s) (filter (complement f) s)])</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,7 +1,9 @@
-<div class="doc-item" id="doc-1001"><h2 class="doc-item-name">alter-var-root<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">alter-var-root</span> v f &amp; args)</li></ul><div class="var-docstring"><p>Atomically alters the root binding of var v by applying f to its
- current value plus any args</p></div><div class="var-source"><pre>; core.clj:3246
-(defn alter-var-root
- [#^clojure.lang.Var v f &amp; args] (.alterRoot v f args))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1001"><h2 class="doc-item-name">seq<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">seq</span> coll)</li></ul><div class="var-docstring"><p>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
+ that implement Iterable.</p></div><div class="var-source"><pre>; clojure/core.clj:96
+(def
+ seq (fn seq [coll] (. clojure.lang.RT (seq coll))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,16 +1,8 @@
-<div class="doc-item" id="doc-1002"><h2 class="doc-item-name">amap<span class="namespace">(clojure.core)</span></h2><p class="macro">Macro</p><ul class="var-arglists"><li>(<span class="var-name">amap</span> a idx ret expr)</li></ul><div class="var-docstring"><p>Maps an expression across an array a, using an index named idx, and
- return value named ret, initialized to a clone of a, then setting each element of
- ret to the evaluation of expr, returning the new array ret.</p></div><div class="var-source"><pre>; core.clj:3135
-(defmacro amap
- [a idx ret expr]
- `(let [a# ~a
- ~ret (aclone a#)]
- (loop [~idx (int 0)]
- (if (&lt; ~idx (alength a#))
- (do
- (aset ~ret ~idx ~expr)
- (recur (unchecked-inc ~idx)))
- ~ret))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1002"><h2 class="doc-item-name">seq-on<span class="namespace">(clojure.contrib.seq-utils)</span></h2><ul class="var-arglists"><li>(<span class="var-name">seq-on</span> s)</li></ul><div class="var-docstring"><p>Returns a seq on the object s. Works like the built-in seq but as
+ a multimethod that can have implementations for new classes and types.</p></div><div class="var-source"><pre>; clojure/contrib/seq_utils.clj:157
+(defmulti seq-on
+ {:arglists '([s])}
+ type)</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,14 +1,10 @@
-<div class="doc-item" id="doc-1003"><h2 class="doc-item-name">ancestors<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">ancestors</span> tag)</li><li>(<span class="var-name">ancestors</span> h tag)</li></ul><div class="var-docstring"><p>Returns the immediate and indirect parents of tag, either via a Java type
- inheritance relationship or a relationship established via derive. h
- must be a hierarchy obtained from make-hierarchy, if not supplied
- defaults to the global hierarchy</p></div><div class="var-source"><pre>; core.clj:3311
-(defn ancestors
- ([tag] (ancestors global-hierarchy tag))
- ([h tag] (not-empty
- (let [ta (get (:ancestors h) tag)]
- (if (class? tag)
- (into (set (supers tag)) ta)
- ta)))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1003"><h2 class="doc-item-name">seq-zip<span class="namespace">(clojure.zip)</span></h2><ul class="var-arglists"><li>(<span class="var-name">seq-zip</span> root)</li></ul><div class="var-docstring"><p>Returns a zipper for nested sequences, given a root sequence</p></div><div class="var-source"><pre>; clojure/zip.clj:31
+(defn seq-zip
+ [root]
+ (zipper seq?
+ identity
+ (fn [node children] (with-meta children (meta node)))
+ root))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,13 +1,6 @@
-<div class="doc-item" id="doc-1004"><h2 class="doc-item-name">and<span class="namespace">(clojure.core)</span></h2><p class="macro">Macro</p><ul class="var-arglists"><li>(<span class="var-name">and</span> )</li><li>(<span class="var-name">and</span> x)</li><li>(<span class="var-name">and</span> x &amp; next)</li></ul><div class="var-docstring"><p>Evaluates exprs one at a time, from left to right. If a form
- returns logical false (nil or false), and returns that value and
- doesn't evaluate any of the other expressions, otherwise it returns
- the value of the last expr. (and) returns true.</p></div><div class="var-source"><pre>; core.clj:513
-(defmacro and
- ([] true)
- ([x] x)
- ([x &amp; next]
- `(let [and# ~x]
- (if and# (and ~@next) and#))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1004"><h2 class="doc-item-name">seq?<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">seq?</span> x)</li></ul><div class="var-docstring"><p>Return true if x implements ISeq</p></div><div class="var-source"><pre>; clojure/core.clj:111
+(def
+ seq? (fn seq? [x] (instance? clojure.lang.ISeq x)))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,8 +1,38 @@
-<div class="doc-item" id="doc-1005"><h2 class="doc-item-name">append-child<span class="namespace">(clojure.zip)</span></h2><ul class="var-arglists"><li>(<span class="var-name">append-child</span> loc item)</li></ul><div class="var-docstring"><p>Inserts the item as the rightmost child of the node at this loc,
- without moving</p></div><div class="var-source"><pre>; zip.clj:188
-(defn append-child
- [loc item]
- (replace loc (make-node loc (node loc) (concat (children loc) [item]))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1005"><h2 class="doc-item-name">seque<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">seque</span> s)</li><li>(<span class="var-name">seque</span> n-or-q s)</li></ul><div class="var-docstring"><p>Creates a queued seq on another (presumably lazy) seq s. The queued
+ seq will produce a concrete seq in the background, and can get up to
+ n items ahead of the consumer. n-or-q can be an integer n buffer
+ size, or an instance of java.util.concurrent BlockingQueue. Note
+ that reading from a seque can block if the reader gets ahead of the
+ producer.</p></div><div class="var-source"><pre>; clojure/core.clj:3414
+(defn seque
+ ([s] (seque 100 s))
+ ([n-or-q s]
+ (let [#^BlockingQueue q (if (instance? BlockingQueue n-or-q)
+ n-or-q
+ (LinkedBlockingQueue. (int n-or-q)))
+ NIL (Object.) ;nil sentinel since LBQ doesn't support nils
+ agt (agent (seq s))
+ fill (fn [s]
+ (try
+ (loop [[x &amp; xs :as s] s]
+ (if s
+ (if (.offer q (if (nil? x) NIL x))
+ (recur xs)
+ s)
+ (.put q q))) ; q itself is eos sentinel
+ (catch Exception e
+ (.put q q)
+ (throw e))))
+ drain (fn drain []
+ (lazy-seq
+ (let [x (.take q)]
+ (if (identical? x q) ;q itself is eos sentinel
+ (do @agt nil) ;touch agent just to propagate errors
+ (do
+ (send-off agt fill)
+ (cons (if (identical? x NIL) nil x) (drain)))))))]
+ (send-off agt fill)
+ (drain))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,8 +1,11 @@
-<div class="doc-item" id="doc-1006"><h2 class="doc-item-name">apply<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">apply</span> f args* argseq)</li></ul><div class="var-docstring"><p>Applies fn f to the argument list formed by prepending args to argseq.</p></div><div class="var-source"><pre>; core.clj:404
-(defn apply
- {:arglists '([f args* argseq])}
- [#^clojure.lang.IFn f &amp; args]
- (. f (applyTo (spread args))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1006"><h2 class="doc-item-name">sequence<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">sequence</span> coll)</li></ul><div class="var-docstring"><p>Coerces coll to a (possibly empty) sequence, if it is not already
+ one. Will not force a lazy seq. (sequence nil) yields ()</p></div><div class="var-source"><pre>; clojure/core.clj:1538
+(defn sequence
+ [coll]
+ (cond
+ (seq? coll) coll
+ (stream? coll) (.sequence #^clojure.lang.Stream coll)
+ :else (or (seq coll) ())))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,13 +1,6 @@
-<div class="doc-item" id="doc-1007"><h2 class="doc-item-name">apply-template<span class="namespace">(clojure.contrib.template)</span></h2><ul class="var-arglists"><li>(<span class="var-name">apply-template</span> expr values)</li></ul><div class="var-docstring"><p>Replaces _1, _2, _3, etc. in expr with corresponding elements of
- values. Returns the modified expression. For use in macros.</p></div><div class="var-source"><pre>; template.clj:128
-(defn apply-template
- [expr values]
- (when-not (template? expr)
- (throw (IllegalArgumentException. (str (pr-str expr) &quot; is not a valid template.&quot;))))
- (let [expr (postwalk-replace {'_ '_1} expr)
- holes (find-holes expr)
- smap (zipmap holes values)]
- (prewalk-replace smap expr)))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1007"><h2 class="doc-item-name">sequential?<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">sequential?</span> coll)</li></ul><div class="var-docstring"><p>Returns true if coll implements Sequential</p></div><div class="var-source"><pre>; clojure/core.clj:4034
+(defn sequential?
+ [coll] (instance? clojure.lang.Sequential coll))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
View
@@ -1,13 +1,6 @@
-<div class="doc-item" id="doc-1008"><h2 class="doc-item-name">areduce<span class="namespace">(clojure.core)</span></h2><p class="macro">Macro</p><ul class="var-arglists"><li>(<span class="var-name">areduce</span> a idx ret init expr)</li></ul><div class="var-docstring"><p>Reduces an expression across an array a, using an index named idx,
- and return value named ret, initialized to init, setting ret to the evaluation of expr at
- each step, returning ret.</p></div><div class="var-source"><pre>; core.clj:3149
-(defmacro areduce
- [a idx ret init expr]
- `(let [a# ~a]
- (loop [~idx (int 0) ~ret ~init]
- (if (&lt; ~idx (alength a#))
- (recur (unchecked-inc ~idx) ~expr)
- ~ret))))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, which can be found in the file
+<div class="doc-item" id="doc-1008"><h2 class="doc-item-name">set<span class="namespace">(clojure.core)</span></h2><ul class="var-arglists"><li>(<span class="var-name">set</span> coll)</li></ul><div class="var-docstring"><p>Returns a set of the distinct elements of coll.</p></div><div class="var-source"><pre>; clojure/core.clj:2473
+(defn set
+ [coll] (apply hash-set coll))</pre></div><div class="license"><p>Copyright (c) Rich Hickey. All rights reserved.</p><p>The use and distribution terms for this software are covered by the <a href="http://opensource.org/licenses/eclipse-1.0.php">Eclipse Public License 1.0</a>, 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
Oops, something went wrong.

0 comments on commit 6e4a67f

Please sign in to comment.