API Overview - clojure-contrib v1.1 (stable)


clojure-contrib is now deprecated

clojure-contrib is no longer being developed or maintained.

Rather than a single, monolithic, contributions library, Clojure now has a set of separate libraries for each unit of functionality. The libraries are in the Clojure GitHub organization at https://github.com/clojure. API documentation of the libraries can be found at https://clojure.github.io.

If you're looking for a specific function or namespace from the old clojure-contrib, see "Where Did Clojure.Contrib Go".

The user contributions library, clojure.contrib, is a collection of namespaces each of which implements features that we believe may be useful to a large part of the clojure community.

This library was created by Rich Hickey but has been populated and is maintained by a group of volunteers who are excited about the success of the Clojure language and want to do our part to help it along. The current list of contributors is available on the clojure-contrib GitHub source page.

More contributions (and contributors) are welcome. If you wish to contribute, you will need to sign a contributor agreement (which allows Clojure and clojure.contrib to proceed without entanglements, see contributing for more info).

The best way to start is to share a project you've written with the google group and gauge the interest in adding it to contrib. (Publishing it in an open source form on google code, github or some other easy-to-access place in the net will also help.) After general discussion, Rich Hickey makes the final determination about what gets added to clojure.contrib.

Some parts of clojure.contrib may migrate into clojure.core if they prove to be so generally useful that they justify being everywhere. (For example, condp started out as an extension in contrib, but was moved to core by popular acclamation.)

The exact role of clojure.contrib and the future of the Clojure environment (standard libraries, dependency models, packaging systems, etc.) is the subject of pretty much continuous discussion in the clojure google group and in #clojure on freenode. Feel free to join that discussion and help shape the ways Clojure is extended.

Like Clojure itself, clojure.contrib is made available under the Eclipse Public License (EPL). clojure.contrib is copyright 2008-2009 Rich Hickey and the various contributors.

Important clojure-contrib resources




accumulators

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
A generic accumulator interface and implementations of various
accumulators.
Public variables and functions: add add-items combine empty-counter empty-counter-with-total empty-list empty-map empty-maximum empty-mean-variance empty-min-max empty-minimum empty-product empty-queue empty-set empty-string empty-sum empty-tuple empty-vector


agent-utils

by Christophe Grande
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Miscellaneous agent utilities
(note to other contrib members: feel free to add to this lib)
Public variables and functions: capture-and-send


apply-macro

Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.




  Public variables and functions:
  apply-macro 


base64

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Base-64 encoding and (maybe later) decoding.

This is mainly here as an example.  It is much slower than the
Apache Commons Codec implementation or sun.misc.BASE64Encoder.
Public variables and functions: encode encode-str


classpath

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Utilities for dealing with the JVM's classpath
Public variables and functions: classpath classpath-directories classpath-jarfiles


combinatorics

by Mark Engelberg
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Efficient, functional algorithms for generating lazy
sequences for common combinatorial functions. (See the source code
for a longer description.)
Public variables and functions: cartesian-product combinations lex-permutations permutations selections subsets


command-line

by Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Process command-line arguments according to a given cmdspec
Public variables and functions: with-command-line


complex-numbers

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Complex numbers
NOTE: This library is in evolution. Most math functions are
      not implemented yet.
Public variables and functions:


cond

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Extensions to the basic cond function.
Public variables and functions: cond-let


condition

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Flexible raising and handling of conditions:

Functions:

              raise: raises a condition
       handler-case: dispatches raised conditions to appropriate handlers
  print-stack-trace: prints abbreviated or full condition stack traces

Data:

  A condition is a map containing values for these keys:

    - :type, a condition type specifier, typically a keyword
    - :stack-trace, a stack trace to the site of the raise
    - :message, a human-readable message (optional)
    - :cause, a wrapped exception or condition (optional)
    - other keys given as arguments to raise (optional)

Note: requires AOT compilation.

Based on an idea from Chouser:
http://groups.google.com/group/clojure/browse_frm/thread/da1285c538f22bb5
Public variables and functions: *full-stack-traces* handler-case print-stack-trace raise stack-trace-info

Variables and functions in condition.Condition: -init -meta -post-init


core

by Laurent Petit (and others)
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Functions/macros variants of the ones that can be found in clojure.core
(note to other contrib members: feel free to add to this lib)
Public variables and functions: -?> .?. dissoc-in new-by-name seqable?


dataflow

by Jeffrey Straszheim
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
A library to support a dataflow model of state
Public variables and functions: add-cell-watcher add-cells build-dataflow build-source-cell build-standard-cell build-validator-cell cell display-cell eval-cell get-cell get-cells get-old-value get-source-cells get-value get-value-from-cell get-values print-dataflow remove-cells source-cell? update-values


datalog

by Jeffrey Straszheim
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
A Clojure implementation of Datalog
Public variables and functions: build-work-plan run-work-plan

Variables and functions in datalog.database: add-index add-relation add-tuple add-tuples any-match? database-counts database-merge database-merge-parallel datalog-relation ensure-relation get-relation make-database merge-relations remove-tuple replace-relation select

Variables and functions in datalog.literals: adorned-literal build-atom build-literal build-seed-bindings delta-literal display-literal get-adorned-bindings get-base-predicate get-cs-from-vs get-self-bound-cs get-vs-from-cs join-literal literal-appropriate? literal-columns literal-magic? literal-predicate literal-vars magic-literal negated-literal negated? negative-vars positive-vars positive? project-literal

Variables and functions in datalog.magic: adorn-query adorn-rules-set build-partial-tuple magic-transform seed-predicate-for-insertion seed-relation seed-rule

Variables and functions in datalog.rules: <- ?- all-predicates apply-rule compute-sip display-query display-rule is-safe? make-rules-set non-base-rules predicate-map return-rule-data rules-set

Variables and functions in datalog.softstrat: build-soft-strat-work-plan get-all-relations

Variables and functions in datalog.util: is-query-var? is-var? keys-to-vals map-values preduce reverse-map trace-datalog


def

Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.




  Public variables and functions:
  defalias defhinted defmacro- defn-memo defnk defonce- defstruct- defunbound defunbound- defvar defvar- name-with-attributes 


duck-streams

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
This file defines "duck-typed" I/O utility functions for Clojure.
The 'reader' and 'writer' functions will open and return an
instance of java.io.BufferedReader and java.io.PrintWriter,
respectively, for a variety of argument types -- filenames as
strings, URLs, java.io.File's, etc.  'reader' even works on http
URLs.

Note: this is not really "duck typing" as implemented in languages
like Ruby.  A better name would have been "do-what-I-mean-streams"
or "just-give-me-a-stream", but ducks are funnier.
Public variables and functions: *append-to-writer* *buffer-size* *byte-array-type* *default-encoding* append-spit append-writer copy file-str make-parents pwd read-lines reader slurp* spit to-byte-array with-in-reader with-out-append-writer with-out-writer write-lines writer


error-kit

by Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
EXPERIMENTAL
System for defining and using custom errors
Please contact Chouser if you have any suggestions for better names
or API adjustments.
Public variables and functions: bind-continue deferror do-not-handle error handle raise raise* throw-msg with-handler


except

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Provides functions that make it easy to specify the class, cause, and
message when throwing an Exception or Error. The optional message is
formatted using clojure.core/format.
Public variables and functions: throw-arg throw-if throw-if-not throwf


fcase

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
This file defines a generic "case" macro called "fcase" which takes
the equality-testing function as an argument.  It also defines a
traditional "case" macro that tests using "=" and variants that
test for regular expressions and class membership.


Note (December 23, 2008): This library has been supplanted by the
inclusion of "condp" in clojure.core as of Clojure SVN rev. 1180.
Public variables and functions: case fcase in-case instance-case re-case


find-namespaces

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Search for ns declarations in dirs, JARs, or CLASSPATH
Public variables and functions: clojure-source-file? clojure-sources-in-jar comment? find-clojure-sources-in-dir find-namespaces-in-dir find-namespaces-in-jarfile find-namespaces-on-classpath find-ns-decls-in-dir find-ns-decls-in-jarfile find-ns-decls-on-classpath ns-decl? read-file-ns-decl read-ns-decl read-ns-decl-from-jarfile-entry


fnmap

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Maps that dispatch get/assoc to user-defined functions.

Note: requires AOT-compilation
Public variables and functions: fnmap


gen-html-docs

by Craig Andera
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Generates a single HTML page that contains the documentation for
one or more Clojure libraries.
Public variables and functions: generate-documentation generate-documentation-to-file


generic.arithmetic

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Generic arithmetic interface
This library defines generic versions of + - * / as multimethods
that can be defined for any type. The minimal required
implementations for a type are binary + and * plus unary - and /.
Everything else is derived from these automatically. Explicit
binary definitions for - and / can be provided for
efficiency reasons.
Public variables and functions: * + - / defmethod* qsym


generic.collection

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Generic arithmetic interface
This library defines generic versions of common
collection-related functions as multimethods that can be
defined for any type.
Public variables and functions: assoc conj dissoc empty get into seq


generic.comparison

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Generic comparison interface
This library defines generic versions of = < > <= >= zero?
as multimethods that can be defined for any type. Of the
greater/less-than relations, types must minimally implement >.
Public variables and functions: < <= = > >= zero?


generic.functor

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Generic functor interface (fmap)
Public variables and functions: fmap


generic.math-functions

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Generic math function interface
This library defines generic versions of common mathematical
functions such as sqrt or sin as multimethods that can be
defined for any type.
Public variables and functions: abs acos approx= asin atan atan2 ceil conjugate cos exp floor log pow rint round sgn sin sqr sqrt tan


graph

by Jeffrey Straszheim
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Basic graph theory algorithms
Public variables and functions: add-loops component-graph dependency-list fixed-point get-neighbors lazy-walk post-ordered-nodes recursive-component? remove-loops reverse-graph scc self-recursive-sets stratification-list transitive-closure


greatest-least

by Vincent Foley
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Various functions for finding greatest and least values in a collection
Public variables and functions: all-greatest all-greatest-by all-least all-least-by greatest greatest-by least least-by


http.agent

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Agent-based asynchronous HTTP client.

This is a HTTP client library based on Java's HttpURLConnection
class and Clojure's Agent system.  It allows you to make multiple
HTTP requests in parallel.

Start an HTTP request with the 'http-agent' function, which
immediately returns a Clojure Agent.  You will never deref this
agent; that is handled by the accessor functions.  The agent will
execute the HTTP request on a separate thread.

If you pass a :handler function to http-agent, that function will be
called as soon as the HTTP response body is ready.  The handler
function is called with one argument, the HTTP agent itself.  The
handler can read the response body by calling the 'stream' function
on the agent.

The value returned by the handler function becomes part of the state
of the agent, and you can retrieve it with the 'result' function.
If you call 'result' before the HTTP request has finished, it will
block until the handler function returns.

If you don't provide a handler function, the default handler will
buffer the entire response body in memory, which you can retrieve
with the 'bytes', 'string', or 'stream' functions.  Like 'result',
these functions will block until the HTTP request is completed.

If you want to check if an HTTP request is finished without
blocking, use the 'done?' function.

A single GET request could be as simple as:

  (string (http-agent "http://www.stuartsierra.com/"))

A simple POST might look like:

  (http-agent "http..." :method "POST" :body "foo=1")

And you could write the response directly to a file like this:

  (require '[clojure.contrib.duck-streams :as d])

  (http-agent "http..."
              :handler (fn [agnt]
                         (with-open [w (d/writer "/tmp/out")]
                           (d/copy (stream agnt) w))))
Public variables and functions: buffer-bytes bytes client-error? done? error? headers headers-seq http-agent message method redirect? request-body request-headers request-uri result server-error? status stream string success?


http.connection

Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Low-level HTTP client API around HttpURLConnection
Public variables and functions: http-connection send-request-entity


import-static

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Import static Java methods/fields into Clojure
Public variables and functions: import-static


jar

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Utilities for working with Java JAR files
Public variables and functions: filenames-in-jar jar-file?


java-utils

Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.




  Public variables and functions:
  as-file as-properties as-str as-url delete-file delete-file-recursively file get-system-property read-properties relative-path-string set-system-properties wall-hack-field wall-hack-method with-system-properties write-properties 


javadoc.browse

by Christophe Grand
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Start a web browser from Clojure
Public variables and functions: open-url-in-browser open-url-in-swing


jmx

by Stuart Halloway
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
JMX support for Clojure

Requires post-Clojure 1.0 git edge for clojure.test, clojure.backtrace.
This is prerelease.
This API will change.
Send reports to stu@thinkrelevance.com.

Usage
  (require '[clojure.contrib.jmx :as jmx])

What beans do I have?

  (jmx/mbean-names "*:*")
  -> #<HashSet [java.lang:type=MemoryPool,name=CMS Old Gen,
                java.lang:type=Memory, ...]

What attributes does a bean have?

  (jmx/attribute-names "java.lang:type=Memory")
  -> (:Verbose :ObjectPendingFinalizationCount
      :HeapMemoryUsage :NonHeapMemoryUsage)

What is the value of an attribute?

  (jmx/read "java.lang:type=Memory" :ObjectPendingFinalizationCount)
  -> 0

Can't I just have *all* the attributes in a Clojure map?

  (jmx/mbean "java.lang:type=Memory")
  -> {:NonHeapMemoryUsage
       {:used 16674024, :max 138412032, :init 24317952, :committed 24317952},
      :HeapMemoryUsage
       {:used 18619064, :max 85393408, :init 0, :committed 83230720},
      :ObjectPendingFinalizationCount 0,
      :Verbose false}

Can I find and invoke an operation?

  (jmx/operation-names "java.lang:type=Memory")
  -> (:gc)
  (jmx/invoke "java.lang:type=Memory" :gc)
  -> nil

What about some other process? Just run *any* of the above code
inside a with-connection:

  (jmx/with-connection {:host "localhost", :port 3000}
    (jmx/mbean "java.lang:type=Memory"))
  -> {:ObjectPendingFinalizationCount 0,
      :HeapMemoryUsage ... etc.}

Can I serve my own beans?  Sure, just drop a Clojure ref
into an instance of clojure.contrib.jmx.Bean, and the bean
will expose read-only attributes for every key/value pair
in the ref:

  (jmx/register-mbean
     (Bean.
     (ref {:string-attribute "a-string"}))
     "my.namespace:name=Value")
Public variables and functions: *connection* as-object-name attribute-info attribute-names build-attribute-info guess-attribute-typename jmx->clj jmx-url map->attribute-infos maybe-atomize maybe-keywordize mbean mbean-names op-param-types operation operation-names operations raw-read read read-exceptions read-supported readable? with-connection


json.read

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
JavaScript Object Notation (JSON) parser

For more information on JSON, see http://www.json.org/

This library parses data in JSON format.  This is a fairly strict
implementation of JSON as described at json.org, not a full-fledged
JavaScript parser.  JavaScript functions and object constructors
are not supported.  Object field names must be quoted strings; they
may not be bare symbols.

If you want to convert map keys from strings to keywords, use
clojure.contrib.walk/keywordize-keys
See also: JSON Home Page
Public variables and functions: *json-keyword-keys* read-json


json.write

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
JavaScript Object Notation (JSON) generator.

This library will generate JSON from the following types:
 * nil
 * all primitives (Boolean, Byte, Short, Integer, Long, Float, Double)
 * String (actually any CharSequence)
 * java.util.Map (including Clojure maps)
 * java.util.Collection (including Clojure vectors, lists, and sets)
 * Java arrays

You can extend this library to handle new types by adding methods to
print-json.

This library does NOT attempt to preserve round-trip equality between
JSON and Clojure data types. That is, if you write a JSON string with
this library, then read it back with clojure.contrib.json.read, you
won't necessarily get the exact same data structure.  For example,
Clojure sets are written as JSON arrays, which will be read back as
Clojure vectors.

If you want indented output, try the clojure-json library at
http://github.com/danlarkin/clojure-json

This implementation attempts to follow the description of JSON at
<http://json.org/>.  Maps become JSON objects, all other collections
become JSON arrays.  JSON object keys are always converted to strings.
Within strings, all non-ASCII characters are hexadecimal escaped.
See also: JSON Home Page
Public variables and functions: json-str print-json


lazy-seqs

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
==== Lazy sequences ====

 primes - based on the "naive" implemention described in [1] plus a
          small "wheel" which eliminates multiples of 2, 3, 5, and
          7 from consideration by incrementing past them. Also inspired
          by code from Christophe Grand in [2].

 fibs   - all the Fibonacci numbers

 powers-of-2 - all the powers of 2

 ==== Lazy sequence functions ====

 (rotations, partition-all, shuffle, rand-elt  moved to seq_utils.clj)
 (permutations and combinations moved to combinatorics.clj)

 [1] http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
 [2] http://clj-me.blogspot.com/2008/06/primes.html
Public variables and functions: fibs powers-of-2 primes


lazy-xml

by Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Functions to parse xml lazily and emit back to text.
Public variables and functions: emit emit-element parse-seq parse-trim


logging

by Alex Taggart, Timothy Pratley
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Logging macros which delegate to a specific logging implementation. At
macro-expansion-time a specific implementation is selected from, in order,
Apache commons-logging, log4j, and finally java.util.logging.

Logging levels are specified by clojure keywords corresponding to the
values used in log4j and commons-logging:
  :trace, :debug, :info, :warn, :error, :fatal

Logging occurs with the log macro, or the level-specific convenience macros,
which write either directly or via an agent.  For performance reasons, direct
logging is enabled by default, but setting the *allow-direct-logging* boolean
atom to false will disable it. If logging is invoked within a transaction it
will always use an agent.

The log macros will not evaluate their 'message' unless the specific logging
level is in effect. Alternately, you can use the spy macro when you have code
that needs to be evaluated, and also want to output the code and its result to
the debug log.

Unless otherwise specified, the current namespace (as identified by *ns*) will
be used as the log-ns (similar to how the java class name is usually used).
Note: your log configuration should display the name that was passed to the
logging implementation, and not perform stack-inspection, otherwise you'll see
something like "fn__72$impl_write_BANG__39__auto____81" in your logs.

Use the enabled? macro to write conditional code against the logging level
(beyond simply whether or not to call log, which is handled automatically).

You can redirect all java writes of System.out and System.err to the log
system by calling log-capture!.  To rebind *out* and *err* to the log system
invoke with-logs.  In both cases a log-ns (e.g., "com.example.captured")
needs to be specified to namespace the output.
Public variables and functions: *allow-direct-logging* *impl-name* *logging-agent* agent-write! debug enabled? error fatal impl-enabled? impl-get-log impl-write! info log log-capture! log-stream log-uncapture! spy trace warn with-logs


macro-utils

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Local macros and symbol macros

Local macros are defined by a macrolet form. They are usable only
inside its body. Symbol macros can be defined globally
(defsymbolmacro) or locally (symbol-macrolet). A symbol
macro defines a form that replaces a symbol during macro
expansion. Function arguments and symbols bound in let
forms are not subject to symbol macro expansion.

Local macros are most useful in the definition of the expansion
of another macro, they may be used anywhere. Global symbol
macros can be used only inside a with-symbol-macros form.
Public variables and functions: defsymbolmacro deftemplate macrolet mexpand mexpand-1 mexpand-all symbol-macrolet with-symbol-macros


macros

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Various small macros
Public variables and functions: const letfn- with-direct-linking


map-utils

by Jason Wolfe, Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Utilities for operating on Clojure maps.
Public variables and functions: deep-merge-with lazy-get safe-get safe-get-in


math

by Mark Engelberg
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Math functions that deal intelligently with the various
types in Clojure's numeric tower, as well as math functions
commonly found in Scheme implementations.

expt - (expt x y) is x to the yth power, returns an exact number
  if the base is an exact number, and the power is an integer,
  otherwise returns a double.
abs - (abs n) is the absolute value of n
gcd - (gcd m n) returns the greatest common divisor of m and n
lcm - (lcm m n) returns the least common multiple of m and n

The behavior of the next three functions on doubles is consistent
with the behavior of the corresponding functions
in Java's Math library, but on exact numbers, returns an integer.

floor - (floor n) returns the greatest integer less than or equal to n.
  If n is an exact number, floor returns an integer,
  otherwise a double.
ceil - (ceil n) returns the least integer greater than or equal to n.
  If n is an exact number, ceil returns an integer,
  otherwise a double.
round - (round n) rounds to the nearest integer.
  round always returns an integer.  round rounds up for values
  exactly in between two integers.


sqrt - Implements the sqrt behavior I'm accustomed to from PLT Scheme,
  specifically, if the input is an exact number, and is a square
  of an exact number, the output will be exact.  The downside
  is that for the common case (inexact square root), some extra
  computation is done to look for an exact square root first.
  So if you need blazingly fast square root performance, and you
  know you're just going to need a double result, you're better
  off calling java's Math/sqrt, or alternatively, you could just
  convert your input to a double before calling this sqrt function.
  If Clojure ever gets complex numbers, then this function will
  need to be updated (so negative inputs yield complex outputs).
exact-integer-sqrt - Implements a math function from the R6RS Scheme
  standard.  (exact-integer-sqrt k) where k is a non-negative integer,
  returns [s r] where k = s^2+r and k < (s+1)^2.  In other words, it
  returns the floor of the square root and the 
Public variables and functions: abs ceil exact-integer-sqrt expt floor gcd lcm round sqrt


miglayout

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Clojure support for the MiGLayout layout manager
http://www.miglayout.com/

Example:

  (use '[clojure.contrib.miglayout.test :as mlt :only ()])
  (dotimes [i 5] (mlt/run-test i))
Public variables and functions: components miglayout

Variables and functions in miglayout.example: converter-ui fahrenheit main

Variables and functions in miglayout.internal: add-components component? constraint? do-layout format-constraint format-constraints get-components parse-component-constraint parse-item-constraints

Variables and functions in miglayout.test: label sep text-field


mmap

by Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Functions for memory-mapping files, plus some functions that use a
mmaped file for "normal" activies -- slurp, load-file, etc.
Public variables and functions: buffer-stream mmap slurp


mock

Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.




  Public variables and functions:
  calls expect has-args has-matching-signature? make-arg-checker make-count-checker make-mock returns times validate-counts 

Variables and functions in mock.test-adapter: calls has-args has-matching-signature? make-arg-checker make-count-checker make-mock report-problem returns times validate-counts


monadic-io-streams

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Monadic I/O with Java input/output streams
Defines monadic I/O statements to be used in a state monad
with an input or output stream as the state. The macro
monadic-io creates a stream, runs a monadic I/O statement
on it, and closes the stream. This structure permits the
definition of purely functional compound I/O statements
which are applied to streams that can never escape from the
monadic statement sequence.
Public variables and functions: flush print println read-char read-line read-lines skip-chars with-io-streams with-reader with-writer write


monads

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
This library contains the most commonly used monads as well
as macros for defining and using monads and useful monadic
functions.
See also: Monad tutorial part 1 Monad tutorial part 2 Monad tutorial part 3 Monad tutorial part 4 Monads in Clojure part 1 Monads in Clojure part 2
Public variables and functions: call-cc cont-m defmonad defmonadfn domonad fetch-state fetch-val identity-m m-chain m-fmap m-join m-lift m-map m-reduce m-seq m-until m-when m-when-not maybe-m maybe-t monad monad-transformer run-cont sequence-m sequence-t set-m set-state set-val state-m state-m-until state-t update-state update-val with-monad with-state-field writer-m


ns-utils

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Namespace utilities
Public variables and functions: dir docs get-ns immigrate ns-vars print-dir print-docs vars


pprint

by Tom Faulhaber
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
This module comprises two elements:
1) A pretty printer for Clojure data structures, implemented in the
   function "pprint"
2) A Common Lisp compatible format function, implemented as
   "cl-format" because Clojure is using the name "format"
   for its Java-based format function.

See documentation for those functions for more information or complete
documentation on the the clojure-contrib web site on github.
Public variables and functions: *code-dispatch* *print-base* *print-circle* *print-lines* *print-miser-width* *print-pprint-dispatch* *print-pretty* *print-radix* *print-right-margin* *print-shared* *print-suppress-namespaces* *simple-dispatch* cl-format compile-format formatter formatter-out fresh-line pp pprint pprint-indent pprint-logical-block pprint-newline pprint-tab set-pprint-dispatch use-method with-pprint-dispatch write write-out

Variables and functions in pprint.examples.json: dispatch-json json-str print-json

Variables and functions in pprint.examples.xml: *html-compatible* *prxml-indent* prxml


probabilities.finite-distributions

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Finite probability distributions
This library defines a monad for combining finite probability
distributions.
Public variables and functions: certainly choose cond-dist-m cond-prob dist-m join-with make-distribution normalize prob uniform zipf


probabilities.monte-carlo

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Monte-Carlo method support

Monte-Carlo methods transform an input random number stream
(usually having a continuous uniform distribution in the
interval [0, 1)) into a random number stream whose distribution
satisfies certain conditions (usually the expectation value
is equal to some desired quantity). They are thus
transformations from one probability distribution to another one.

This library represents a Monte-Carlo method by a function that
takes as input the state of a random number stream with
uniform distribution (see
clojure.contrib.probabilities.random-numbers) and returns a
vector containing one sample value of the desired output
distribution and the final state of the input random number
stream. Such functions are state monad values and can be
composed using operations defined in clojure.contrib.monads.
Public variables and functions: discrete exponential lognormal n-sphere normal normal-box-muller random-stream reject sample sample-mean sample-mean-variance sample-reduce sample-sum


probabilities.random-numbers

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Random number streams

This library provides random number generators with a common
stream interface. They all produce pseudo-random numbers that are
uniformly distributed in the interval [0, 1), i.e. 0 is a
possible value but 1 isn't. For transformations to other
distributions, see clojure.contrib.probabilities.monte-carlo.

At the moment, the only generator provided is a rather simple
linear congruential generator.
Public variables and functions: lcg rand-stream


profile

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Simple code profiling & timing measurement.

Wrap any section of code in the prof macro, giving it a name, like this:

       (defn my-function [x y]
         (let [sum (prof :addition (+ x y))
               product (prof :multiplication (* x y))]
           [sum product]))

The run your code in the profile macro, like this:

       (profile (dotimes [i 10000] (my-function 3 4)))

Which prints a report for each named section of code:

          Name      mean       min       max     count       sum
      addition       265         0     37000     10000   2655000
multiplication       274         0     53000     10000   2747000

Times are measured in nanoseconds, to the maximum precision available
under the JVM.  See the function documentation for more details.
Public variables and functions: *enable-profiling* print-summary prof profile summarize with-profile-data


prxml

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Compact syntax for generating XML. See the documentation of "prxml"
for details.
Public variables and functions: *html-compatible* *prxml-indent* prxml


repl-ln

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
A repl with that provides support for lines and line numbers in the
input stream.
Public variables and functions: print-repl-info repl repl-info repl-prompt set-repl-name set-repl-prompt stream-repl


repl-utils

by Chris Houser, Christophe Grand, Stephen Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Utilities meant to be used interactively at the REPL
Public variables and functions: *local-javadocs* *remote-javadocs* add-break-thread! add-local-javadoc add-remote-javadoc break-threads expression-info find-javadoc-url get-source javadoc run run* show source start-handling-break


seq-utils

by Stuart Sierra (and others)
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Sequence utilities for Clojure
Public variables and functions: fill-queue find-first flatten frequencies group-by includes? indexed partition-all partition-by positions rand-elt rec-cat rec-seq reductions rotations separate seq-on shuffle


server-socket

by Craig McDaniel
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Server socket library - includes REPL on socket
Public variables and functions: create-repl-server create-server


set

by Jason Wolfe
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Clojure functions for operating on sets (supplemental to clojure.set)
Public variables and functions: proper-subset? proper-superset? subset? superset?


shell-out

by Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Conveniently launch a sub-process providing to its stdin and
collecting its stdout
Public variables and functions: sh


singleton

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Singleton functions
Public variables and functions: global-singleton per-thread-singleton


sql

by Stephen C. Gilardi
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
A Clojure interface to sql databases via jdbc

See clojure.contrib.sql.test for an example
See also: Example code
Public variables and functions: connection create-table delete-rows do-commands do-prepared drop-table find-connection insert-records insert-rows insert-values is-rollback-only set-rollback-only transaction update-or-insert-values update-values with-connection with-query-results

Variables and functions in sql.internal: connection* find-connection* get-connection print-sql-exception print-sql-exception-chain print-update-counts rollback throw-rollback transaction* with-connection* with-query-results*

Variables and functions in sql.test: create-fruit db-batchupdate-exception db-exception db-get-tables db-grade-a db-grade-range db-read db-read-all db-rollback db-sql-exception db-update db-update-appearance-cost db-update-or-insert db-write drop-fruit insert-records-fruit insert-rows-fruit insert-values-fruit


str-utils

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
String utilities for Clojure
Public variables and functions: chomp chop re-gsub re-partition re-split re-sub str-join


str-utils2

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
This is a library of string manipulation functions.  It
is intented as a replacement for clojure.contrib.str-utils.

You cannot (use 'clojure.contrib.str-utils2) because it defines
functions with the same names as functions in clojure.core.
Instead, do (require '[clojure.contrib.str-utils2 :as s])
or something similar.

Goals:
  1. Be functional
  2. String argument first, to work with ->
  3. Performance linear in string length

Some ideas are borrowed from
http://github.com/francoisdevlin/devlinsf-clojure-utils/
Public variables and functions: blank? butlast capitalize chomp chop codepoints contains? dochars docodepoints drop escape get grep join lower-case ltrim map-str partial partition repeat replace replace-first reverse rtrim split split-lines swap-case tail take trim upper-case


stream-utils

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Functions for setting up computational pipelines via data streams.

NOTE: This library is experimental. It may change significantly
      with future release.

This library defines:
- an abstract stream type, whose interface consists of the
  multimethod stream-next
- a macro for implementing streams
- implementations of stream for
  1) Clojure sequences, and vectors
  2) nil, representing an empty stream
- tools for writing stream transformers, including the
  monad stream-m
- various utility functions for working with streams

Streams are building blocks in the construction of computational
pipelines. A stream is represented by its current state plus
a function that takes a stream state and obtains the next item
in the stream as well as the new stream state. The state is
implemented as a Java class or a Clojure type (as defined by the
function clojure.core/type), and the function is provided as an
implementation of the multimethod stream-next for this class or type.

While setting up pipelines using this mechanism is somewhat more
cumbersome than using Clojure's lazy seq mechanisms, there are a
few advantages:
- The state of a stream can be stored in any Clojure data structure,
  and the stream can be re-generated from it any number of times.
  Any number of states can be stored this way.
- The elements of the stream are never cached, so keeping a reference
  to a stream state does not incur an uncontrollable memory penalty.

Note that the stream mechanism is thread-safe as long as the
concrete stream implementations do not use any mutable state.

Stream transformers take any number of input streams and produce one
output stream. They are typically written using the stream-m
monad. In the definition of a stream transformer, (pick s) returns
the next value of stream argument s, whereas pick-all returns the
next value of all stream arguments in the form of a vector.
Public variables and functions: defst defstream pick pick-all stream-drop stream-filter stream-flatten stream-m stream-map stream-next stream-seq stream-type


swing-utils

Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.




  Public variables and functions:
  action-translation-table add-action-listener add-key-typed-listener add-menu-item do-swing do-swing* do-swing-and-wait make-action make-menubar menu-constructor-dispatch 


test-is

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Backwards-compatibility for clojure.contrib.test-is

The clojure.contrib.test-is library moved from Contrib into the
Clojure distribution as clojure.test.

This happened on or around clojure-contrib Git commit
82cf0409d0fcb71be477ebfc4da18ee2128a2ad1 on June 25, 2009.

This file makes the clojure.test interface available under the old
namespace clojure.contrib.test-is.

This includes support for the old syntax of the 'are' macro.

This was suggested by Howard Lewis Ship in ticket #26,
http://www.assembla.com/spaces/clojure-contrib/tickets/26
Public variables and functions: *load-tests* *stack-trace-depth* apply-template are assert-any assert-predicate compose-fixtures deftest deftest- do-template file-position find-holes find-pure-exprs find-symbols flatten-map function? get-possibly-unbound-var inc-report-counter is join-fixtures report run-all-tests run-tests set-test successful? template? test-all-vars test-ns test-var testing testing-contexts-str testing-vars-str try-expr use-fixtures with-test with-test-out


trace

by Stuart Sierra, Michel Salim
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
This file defines simple "tracing" macros to help you see what your
code is doing.
Public variables and functions: *trace-depth* deftrace dotrace trace trace-fn-call trace-indent tracer


types

by Konrad Hinsen
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
General and algebraic data types
Public variables and functions: defadt deftype deftype- match


with-ns

by Stuart Sierra
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
Temporary namespace macro
Public variables and functions: with-ns with-temp-ns


zip-filter

by Chris Houser
Detailed API documentation
This library, clojure-contrib, is deprecated. See here for more information.
System for filtering trees and nodes generated by zip.clj in
general, and xml trees in particular.
Public variables and functions: ancestors children children-auto descendants left-locs leftmost? right-locs rightmost?

Variables and functions in zip-filter.xml: attr attr= seq-test tag= text text= xml-> xml1->
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.