diff options
author | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-05-03 15:45:02 +0000 |
---|---|---|
committer | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-05-03 15:45:02 +0000 |
commit | bdc813a0d39cb3c6184c4e123d847458e9c77711 (patch) | |
tree | bfd2af2560617b72f4b8f827b5e7467770637230 | |
parent | 47a2f69414f0c3ff90fb2fad4930d9af3d491d23 (diff) |
Namespace documentation for autodoc
21 files changed, 212 insertions, 147 deletions
diff --git a/src/clojure/contrib/accumulators.clj b/src/clojure/contrib/accumulators.clj index d6de6a25..5ccee1df 100644 --- a/src/clojure/contrib/accumulators.clj +++ b/src/clojure/contrib/accumulators.clj @@ -1,7 +1,7 @@ ;; Accumulators ;; by Konrad Hinsen -;; last updated April 21, 2009 +;; last updated May 3, 2009 ;; This module defines various accumulators (list, vector, map, ;; sum, product, counter, and combinations thereof) with a common @@ -18,7 +18,11 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.accumulators +(ns + #^{:author "Konrad Hinsen" + :doc "A generic accumulator interface and implementations of various + accumulators."} + clojure.contrib.accumulators (:use [clojure.contrib.types :only (deftype)]) (:use [clojure.contrib.def :only (defvar defvar- defmacro-)]) (:require [clojure.contrib.generic.arithmetic :as ga])) diff --git a/src/clojure/contrib/accumulators/examples.clj b/src/clojure/contrib/accumulators/examples.clj index f30483cc..b9dcbee5 100644 --- a/src/clojure/contrib/accumulators/examples.clj +++ b/src/clojure/contrib/accumulators/examples.clj @@ -6,7 +6,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(ns clojure.contrib.accumulators.examples +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Examples for using accumulators"} + clojure.contrib.accumulators.examples (:use [clojure.contrib.accumulators :only (combine add add-items empty-vector empty-list empty-queue empty-set empty-map diff --git a/src/clojure/contrib/complex_numbers.clj b/src/clojure/contrib/complex_numbers.clj index 942051da..25e5dc7c 100644 --- a/src/clojure/contrib/complex_numbers.clj +++ b/src/clojure/contrib/complex_numbers.clj @@ -1,7 +1,7 @@ ;; Complex numbers ;; by Konrad Hinsen -;; last updated April 2, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,10 +11,12 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.complex-numbers - "Complex numbers - - NOTE: This library is in evolution. It may change with future releases." +(ns + #^{:author "Konrad Hinsen" + :doc "Complex numbers + NOTE: This library is in evolution. + It may change with future releases."} + clojure.contrib.complex-numbers (:use [clojure.contrib.types :only (deftype)] [clojure.contrib.generic :only (root-type)]) (:require [clojure.contrib.generic.arithmetic :as ga] diff --git a/src/clojure/contrib/generic.clj b/src/clojure/contrib/generic.clj index d16e5ed0..87dda0d3 100644 --- a/src/clojure/contrib/generic.clj +++ b/src/clojure/contrib/generic.clj @@ -1,10 +1,23 @@ ;; Support code for generic interfaces -(ns clojure.contrib.generic - "Generic interface support code +;; by Konrad Hinsen +;; last updated May 3, 2009 - NOTE: This library is VERY experimental. It WILL change significantly - with future release." +;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use +;; and distribution terms for this software are covered by the Eclipse +;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) +;; 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 software. + +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Generic interface support code + NOTE: This library is VERY experimental. It WILL change + significantly with future release."} + clojure.contrib.generic (:use [clojure.contrib.types :only (defadt)])) ; diff --git a/src/clojure/contrib/generic/arithmetic.clj b/src/clojure/contrib/generic/arithmetic.clj index e7e01b42..b6f0a6ff 100644 --- a/src/clojure/contrib/generic/arithmetic.clj +++ b/src/clojure/contrib/generic/arithmetic.clj @@ -1,7 +1,7 @@ ;; Generic interfaces for arithmetic operations ;; by Konrad Hinsen -;; last updated March 19, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,17 +11,16 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.generic.arithmetic - "Generic arithmetic interface - - NOTE: This library is VERY experimental. It WILL change significantly - with future release. - - 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." +(ns + #^{:author "Konrad Hinsen" + :doc "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."} + clojure.contrib.generic.arithmetic (:use [clojure.contrib.generic :only (root-type nulary-type nary-type nary-dispatch)] [clojure.contrib.types :only (defadt)]) diff --git a/src/clojure/contrib/generic/collection.clj b/src/clojure/contrib/generic/collection.clj index 7d521804..8bb39a94 100644 --- a/src/clojure/contrib/generic/collection.clj +++ b/src/clojure/contrib/generic/collection.clj @@ -1,7 +1,7 @@ ;; Generic interfaces for collection-related functions ;; by Konrad Hinsen -;; last updated March 18, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,14 +11,13 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.generic.collection - "Generic collection function interface - - NOTE: This library is VERY experimental. It WILL change significantly - with future release. - - This library defines generic versions of common collection-related functions - as multimethods that can be defined for any type." +(ns + #^{:author "Konrad Hinsen" + :doc "Generic arithmetic interface + This library defines generic versions of common + collection-related functions as multimethods that can be + defined for any type."} + clojure.contrib.generic.collection (:refer-clojure :exclude [assoc conj dissoc empty get into seq])) ; diff --git a/src/clojure/contrib/generic/comparison.clj b/src/clojure/contrib/generic/comparison.clj index 237a8e98..dbed2926 100644 --- a/src/clojure/contrib/generic/comparison.clj +++ b/src/clojure/contrib/generic/comparison.clj @@ -1,7 +1,7 @@ ;; Generic interfaces for comparison operations ;; by Konrad Hinsen -;; last updated March 23, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,15 +11,13 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.generic.comparison - "Generic comparison interface - - NOTE: This library is VERY experimental. It WILL change significantly - with future release. - - 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 >." +(ns + #^{:author "Konrad Hinsen" + :doc "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 >."} + clojure.contrib.generic.comparison (:refer-clojure :exclude [= < > <= >= zero?]) (:use [clojure.contrib.generic :only (root-type nulary-type nary-type nary-dispatch)])) diff --git a/src/clojure/contrib/generic/functor.clj b/src/clojure/contrib/generic/functor.clj index 8611916f..9faf4603 100644 --- a/src/clojure/contrib/generic/functor.clj +++ b/src/clojure/contrib/generic/functor.clj @@ -1,7 +1,7 @@ ;; Generic interface for functors ;; by Konrad Hinsen -;; last updated March 23, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,8 +11,10 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.generic.functor - "Generic functor interface") +(ns + #^{:author "Konrad Hinsen" + :doc "Generic functor interface (fmap)"} + clojure.contrib.generic.functor) (defmulti fmap diff --git a/src/clojure/contrib/generic/math_functions.clj b/src/clojure/contrib/generic/math_functions.clj index 77623cce..3eebe938 100644 --- a/src/clojure/contrib/generic/math_functions.clj +++ b/src/clojure/contrib/generic/math_functions.clj @@ -1,7 +1,7 @@ ;; Generic interfaces for mathematical functions ;; by Konrad Hinsen -;; last updated March 23, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,14 +11,13 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.generic.math-functions - "Generic math function interface - - NOTE: This library is VERY experimental. It WILL change significantly - with future release. - - This library defines generic versions of common mathematical functions - such as sqrt or sin as multimethods that can be defined for any type." +(ns + #^{:author "Konrad Hinsen" + :doc "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."} + clojure.contrib.generic.math-functions (:use [clojure.contrib.def :only (defmacro-)]) (:require [clojure.contrib.generic.arithmetic :as ga] [clojure.contrib.generic.comparison :as gc])) diff --git a/src/clojure/contrib/macros.clj b/src/clojure/contrib/macros.clj index 58236fbf..c9e96a65 100644 --- a/src/clojure/contrib/macros.clj +++ b/src/clojure/contrib/macros.clj @@ -9,7 +9,10 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.macros) +(ns + #^{:author "Konrad Hinsen" + :doc "Various small macros"} + clojure.contrib.macros) ;; By Konrad Hinsen (defmacro const diff --git a/src/clojure/contrib/monads.clj b/src/clojure/contrib/monads.clj index 91d72ab3..2f83bd11 100644 --- a/src/clojure/contrib/monads.clj +++ b/src/clojure/contrib/monads.clj @@ -1,7 +1,7 @@ ;; Monads in Clojure ;; by Konrad Hinsen -;; last updated April 29, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,7 +11,16 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.monads +(ns + #^{:author "Konrad Hinsen" + :see-also [["http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/" "Monad tutorial part 1"] + ["http://onclojure.com/2009/03/06/a-monad-tutorial-for-clojure-programmers-part-2/" "Monad tutorial part 2"] + ["http://onclojure.com/2009/03/23/a-monad-tutorial-for-clojure-programmers-part-3/" "Monad tutorial part 3"] + ["http://onclojure.com/2009/04/24/a-monad-tutorial-for-clojure-programmers-part-4/" "Monad tutorial part 4"]] + :doc "This library contains the most commonly used monads as well + as macros for defining and using monads and useful monadic + functions."} + clojure.contrib.monads (:require [clojure.contrib.accumulators]) (:use [clojure.contrib.def :only (name-with-attributes)])) diff --git a/src/clojure/contrib/monads/examples.clj b/src/clojure/contrib/monads/examples.clj index 29a0b539..00e5dfaf 100644 --- a/src/clojure/contrib/monads/examples.clj +++ b/src/clojure/contrib/monads/examples.clj @@ -6,7 +6,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(ns clojure.contrib.monads.examples +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Examples for using monads"} + clojure.contrib.monads.examples (:use [clojure.contrib.monads :only (domonad with-monad m-lift m-seq m-reduce m-when sequence-m diff --git a/src/clojure/contrib/probabilities/examples_finite_distributions.clj b/src/clojure/contrib/probabilities/examples_finite_distributions.clj index ca301654..56f25bad 100644 --- a/src/clojure/contrib/probabilities/examples_finite_distributions.clj +++ b/src/clojure/contrib/probabilities/examples_finite_distributions.clj @@ -6,13 +6,17 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(ns clojure.contrib.probabilities.examples-finite-distributions - (:use [clojure.contrib.probabilities.finite-distributions - :only (uniform prob cond-prob join-with dist-m choose - normalize certainly cond-dist-m normalize-cond)]) - (:use [clojure.contrib.monads - :only (domonad with-monad m-seq m-chain m-lift)]) - (:require clojure.contrib.accumulators)) +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Examples for finite probability distribution"} + clojure.contrib.probabilities.examples-finite-distributions + (:use [clojure.contrib.probabilities.finite-distributions + :only (uniform prob cond-prob join-with dist-m choose + normalize certainly cond-dist-m normalize-cond)]) + (:use [clojure.contrib.monads + :only (domonad with-monad m-seq m-chain m-lift)]) + (:require clojure.contrib.accumulators)) ;; Simple examples using dice diff --git a/src/clojure/contrib/probabilities/examples_monte_carlo.clj b/src/clojure/contrib/probabilities/examples_monte_carlo.clj index 13796e2f..44c6a7e2 100644 --- a/src/clojure/contrib/probabilities/examples_monte_carlo.clj +++ b/src/clojure/contrib/probabilities/examples_monte_carlo.clj @@ -6,7 +6,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(ns clojure.contrib.probabilities.random.examples-monte-carlo +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Examples for monte carlo methods"} + clojure.contrib.probabilities.random.examples-monte-carlo (:require [clojure.contrib.generic.collection :as gc]) (:use [clojure.contrib.probabilities.random-numbers :only (lcg rand-stream)]) diff --git a/src/clojure/contrib/probabilities/finite_distributions.clj b/src/clojure/contrib/probabilities/finite_distributions.clj index 3b76b318..d1023bac 100644 --- a/src/clojure/contrib/probabilities/finite_distributions.clj +++ b/src/clojure/contrib/probabilities/finite_distributions.clj @@ -1,7 +1,7 @@ ;; Finite probability distributions ;; by Konrad Hinsen -;; last updated April 16, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,7 +11,12 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.probabilities.finite-distributions +(ns + #^{:author "Konrad Hinsen" + :doc "Finite probability distributions + This library defines a monad for combining finite probability + distributions."} + clojure.contrib.probabilities.finite-distributions (:use [clojure.contrib.monads :only (defmonad domonad with-monad maybe-t m-lift m-chain)] [clojure.contrib.def :only (defvar)])) diff --git a/src/clojure/contrib/probabilities/monte_carlo.clj b/src/clojure/contrib/probabilities/monte_carlo.clj index 83bda5bf..6e140a48 100644 --- a/src/clojure/contrib/probabilities/monte_carlo.clj +++ b/src/clojure/contrib/probabilities/monte_carlo.clj @@ -1,7 +1,7 @@ ;; Monte-Carlo algorithms ;; by Konrad Hinsen -;; last updated April 21, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,24 +11,26 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.probabilities.monte-carlo - "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. - " +(ns + #^{:author "Konrad Hinsen" + :doc "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."} + clojure.contrib.probabilities.monte-carlo (:use [clojure.contrib.macros :only (const)]) (:use [clojure.contrib.types :only (deftype)]) (:use [clojure.contrib.stream-utils :only (defstream stream-next)]) diff --git a/src/clojure/contrib/probabilities/random_numbers.clj b/src/clojure/contrib/probabilities/random_numbers.clj index 451a10c5..bf6372f0 100644 --- a/src/clojure/contrib/probabilities/random_numbers.clj +++ b/src/clojure/contrib/probabilities/random_numbers.clj @@ -1,7 +1,7 @@ ;; Random number generators ;; by Konrad Hinsen -;; last updated April 16, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,14 +11,19 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.probabilities.random-numbers - "Random number streams +(ns + #^{:author "Konrad Hinsen" + :doc "Random number streams - This library provides various 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." + 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."} + clojure.contrib.probabilities.random-numbers (:use [clojure.contrib.types :only (deftype)]) (:use [clojure.contrib.stream-utils :only (defstream)]) (:use [clojure.contrib.def :only (defvar)])) diff --git a/src/clojure/contrib/stream_utils.clj b/src/clojure/contrib/stream_utils.clj index 15761771..4533f384 100644 --- a/src/clojure/contrib/stream_utils.clj +++ b/src/clojure/contrib/stream_utils.clj @@ -1,7 +1,7 @@ ;; Stream utilities ;; by Konrad Hinsen -;; last updated March 16, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,48 +11,50 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.stream-utils - "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." - +(ns + #^{:author "Konrad Hinsen" + :doc "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."} + clojure.contrib.stream-utils (:use [clojure.contrib.types :only (deftype deftype-)]) (:use [clojure.contrib.monads :only (defmonad with-monad)]) (:use [clojure.contrib.def :only (defvar defvar-)]) diff --git a/src/clojure/contrib/stream_utils/examples.clj b/src/clojure/contrib/stream_utils/examples.clj index 5b98c65f..018d63c8 100644 --- a/src/clojure/contrib/stream_utils/examples.clj +++ b/src/clojure/contrib/stream_utils/examples.clj @@ -6,7 +6,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(ns clojure.contrib.stream-utils.examples +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Examples for data streams"} + clojure.contrib.stream-utils.examples (:use [clojure.contrib.stream-utils :only (defst stream-next pick pick-all diff --git a/src/clojure/contrib/types.clj b/src/clojure/contrib/types.clj index 0dbda8f3..b3c2bcbe 100644 --- a/src/clojure/contrib/types.clj +++ b/src/clojure/contrib/types.clj @@ -1,7 +1,7 @@ ;; Data types ;; by Konrad Hinsen -;; last updated April 21, 2009 +;; last updated May 3, 2009 ;; Copyright (c) Konrad Hinsen, 2009. All rights reserved. The use ;; and distribution terms for this software are covered by the Eclipse @@ -11,11 +11,10 @@ ;; agreeing to be bound by the terms of this license. You must not ;; remove this notice, or any other, from this software. -(ns clojure.contrib.types - "General and algebraic data types - - NOTE: This library is experimental. It may change significantly - with future release." +(ns + #^{:author "Konrad Hinsen" + :doc "General and algebraic data types"} + clojure.contrib.types (:use [clojure.contrib.def :only (name-with-attributes)])) ; diff --git a/src/clojure/contrib/types/examples.clj b/src/clojure/contrib/types/examples.clj index 1ee27964..de2a9137 100644 --- a/src/clojure/contrib/types/examples.clj +++ b/src/clojure/contrib/types/examples.clj @@ -6,7 +6,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(ns clojure.contrib.types.examples +(ns + #^{:author "Konrad Hinsen" + :skip-wiki true + :doc "Examples for data type definitions"} + clojure.contrib.types.examples (:use [clojure.contrib.types :only (deftype defadt match)]) (:require [clojure.contrib.generic.collection :as gc]) |