API for accumulators - clojure-contrib next (in development)

by Konrad Hinsen

Usage:
(ns your-namespace
  (:require clojure.contrib.accumulators))

Overview

A generic accumulator interface and implementations of various
accumulators.

Public Variables and Functions



add

multimethod
Usage: (add acc item)
Add item to the accumulator acc. The exact meaning of adding an
an item depends on the type of the accumulator.
Source


add-items

function
Usage: (add-items acc items)
Add all elements of a collection coll to the accumulator acc.


combine

multimethod
Usage: (combine & accs)
Combine the values of the accumulators acc1 and acc2 into a
single accumulator of the same type.
Source


empty-counter

var

  
An empty counter accumulator. Its value is a map that stores for
every item the number of times it was added.


empty-counter-with-total

var

  
An empty counter-with-total accumulator. It works like the counter
accumulator, except that the total number of items added is stored as the
value of the key :total.


empty-list

var

  
An empty list accumulator. Adding an item appends it at the beginning.


empty-map

var

  
An empty map accumulator. Items to be added must be [key value] pairs.


empty-maximum

var

  
An empty maximum accumulator. Only numbers can be added.


empty-mean-variance

var

  
An empty mean-variance accumulator, combining sample mean and
sample variance. Only numbers can be added.


empty-min-max

var

  
An empty min-max accumulator, combining minimum and maximum.
Only numbers can be added.


empty-minimum

var

  
An empty minimum accumulator. Only numbers can be added.


empty-product

var

  
An empty sum accumulator. Only numbers can be added.


empty-queue

var

  
An empty queue accumulator. Adding an item appends it at the end.


empty-set

var

  
An empty set accumulator.


empty-string

var

  
An empty string accumulator. Adding an item (string or character)
appends it at the end.


empty-sum

var

  
An empty sum accumulator. Only numbers can be added.


empty-tuple

function
Usage: (empty-tuple empty-accumulators)
Returns an accumulator tuple with the supplied empty-accumulators
as its value. Accumulator tuples consist of several accumulators that
work in parallel. Added items must be sequences whose number of elements
matches the number of sub-accumulators.


empty-vector

var

  
An empty vector accumulator. Adding an item appends it at the end.
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.