The collectors Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The collectors Reference Manual

This is the collectors Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 08:30:21 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Collectors

A small collection of common lisp macros to make collecting values easier.

Origin Info

Much of this code was originally in arnesi, but I often want to use these in code that doesnt need to require all of arnesi. Also arnesi is hard to update.

original arnesi docs

At this point the API and performance profile has diverged from ARNESI

API

Definitions - as applied to this library

Aggregators: functions / objects which take many values and combine them in some logical way. All aggregators accept N values and, after aggregating each of them, return the new aggregate value

Reducers: aggregate values by combining new values into a single value, eg: #'+ can be used to reduce successive numbers into their sum

Collectors: aggregate items into a list by adding each item to the end of a list.

Appenders: aggregate items into a list by appending each item to the end. If single, the item is collected, if a list, it is appended eg: (app (1) 2 (3 (4))) => (1 2 3 (4))

Pusher: collect items (by push) at the beginning of a list

Simple aggregators

Simple aggregators are lambdas which do not signal (are not filterable), and store their data in local places.

append-at-end, collect-at-end

Macros for inlining collection at the end of a list by providing places for each operation

make-simple-collector / make-simple-appender

Quickest possible function based implementation of a collector / appender. Returns (lambda (&rest values) {do} collected-values), The -to-place variants are macros that build the same function, but with the head of the list stored in a user-provided place

Nonsimple aggregators

Non simple aggregators are funcallable CLOS instances with a type heirachy rooted at value-aggregator.

These type of aggregators support a standard set of operations and signals.

operate / deoperate

These methods perform the correct operation for the type of aggregator (EG: reducing, appending, collecting, pushing). Deoperate attempts to undo the operation (currently only defined for the list types).

should-aggregate?

Given an aggregator and a value, should we include the value in our collection. Used in conjunction with the skip restart to orchestrate skipping items.

Place Setters

This is function (or list thereof) that writes the aggregate value to the place after each

Signals and Restarts

make-collector, make-pusher, make-reducer, make-appender

Creates a funcallable instance to perform the expected operation

Strings: make-formatter (fn), string-formatter (class), with-formatter (macro)

String formatters accept a format-string and list of arguments, and use format to process the two into a string. If a stream is provided we write that string to the stream. We also always concatenate the results of all formatter calls. The function (as all aggregators) returns the concatenated results of all calls.

Optionally a delimiter will be written between each call to the formatter.

A provided stream will be written to as each formatter call is made.

Strings: make-string-builder / with-string-builder / with-string-builder-output

Create a function that will build up a string for you. Each call to the function concatenates all arguments (coerced to string via princ) into the result.

if ignore-empty-strings-and-nil is true neither empty strings nor nil will be collect to the stream / aggregate. (Delimiters will also be elided)

Optionally a delimiter will be written between each call to the formatter.

A provided stream will be written to as each formatter call is made.

Context Macros with-collector & with-collector-output

Create a lexical function that calls a new aggregator of the requested type. When using the -output variants, the aggregate value is returned from the form. Otherwise, the value of the last form is returned per-usual.

   (with-collector (col)
       (col 1) ; (1)
       (col 2) ; (1 2)
       (col 3) ; (1 2 3)
       (col)) => (1 2 3)

Authors

;; Copyright (c) 2011 Russ Tyndall , Acceleration.net http://www.acceleration.net
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;;
;;  - Redistributions of source code must retain the above copyright
;;    notice, this list of conditions and the following disclaimer.
;;
;;  - Redistributions in binary form must reproduce the above copyright
;;    notice, this list of conditions and the following disclaimer in the
;;    documentation and/or other materials provided with the distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;; A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 collectors

Maintainer

Russ Tyndall <russ@acceleration.net>

Author

Marco Baringer, Russ Tyndall <russ@acceleration.net>

License

BSD

Description

A library providing various collector type macros
pulled from arnesi into its own library and stripped of dependencies

Version

0.1

Dependencies
Source

collectors.asd (file)

Component

collectors.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 collectors.asd

Location

collectors.asd

Systems

collectors (system)

Packages

collectors.system


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 collectors/collectors.lisp

Parent

collectors (system)

Location

collectors.lisp

Packages
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 collectors.system

Source

collectors.asd

Use List

Next: , Previous: , Up: Packages   [Contents][Index]

4.2 collectors

Source

collectors.lisp (file)

Use List
Exported Definitions
Internal Definitions

Previous: , Up: Packages   [Contents][Index]

4.3 collectors-signals

Source

collectors.lisp (file)

Used By List

collectors

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: append-at-end HEAD-PLACE TAIL-PLACE VALUES-PLACE

Macros to ease efficient collection (with appending) at the end of a list

Package

collectors

Source

collectors.lisp (file)

Macro: appending (ARG LIST) &body BODY

A mapping collecting macro for operating on elements of a list (similar to (mapcan (lambda (,arg) ,@body) list), but using a collector so all signals are in place)

Package

collectors

Source

collectors.lisp (file)

Macro: collect-at-end HEAD-PLACE TAIL-PLACE VALUES-PLACE

Macros to ease efficient collection at the end of a list

Package

collectors

Source

collectors.lisp (file)

Macro: collecting (ARG LIST) &body BODY

A mapping collecting macro for operating on elements of a list (similar to (mapcar (lambda (,arg) ,@body) list), but using a collector so all signals are in place)

Package

collectors

Source

collectors.lisp (file)

Macro: make-simple-appender-to-place PLACE

A fastest possible, fewest frills collector suitable to places where efficiency matters that appends any values that re lists

Package

collectors

Source

collectors.lisp (file)

Macro: make-simple-collector-to-place PLACE
Package

collectors

Source

collectors.lisp (file)

Macro: with-alist-output (NAME &key COLLECT-NIL INITIAL-VALUE FROM-END PLACE) &body BODY
Package

collectors

Source

collectors.lisp (file)

Macro: with-appender (NAME &key INITIAL-VALUE PLACE) &body BODY

Bind NAME to a collector function and execute BODY. If FROM-END is true the collector will actually be a pusher, (see MAKE-PUSHER), otherwise NAME will be bound to a collector, (see MAKE-COLLECTOR).

(with-appender (app)
(app ’(1 2))
(app ’(2 3))
(app ’(3 4))
(app)) => (1 2 2 3 3 4)

Package

collectors

Source

collectors.lisp (file)

Macro: with-appender-output (NAME &key INITIAL-VALUE PLACE) &body BODY

Same as with-appender, but this form returns the collected values automatically

Package

collectors

Source

collectors.lisp (file)

Macro: with-collector (NAME &key PLACE COLLECT-NIL INITIAL-VALUE FROM-END) &body BODY

Bind NAME to a collector function and execute BODY. If FROM-END is true the collector will actually be a pusher, (see MAKE-PUSHER), otherwise NAME will be bound to a collector, (see MAKE-COLLECTOR).
(with-collector (col)
(col 1)
(col 2)
(col 3)
(col)) => (1 2 3)

Package

collectors

Source

collectors.lisp (file)

Macro: with-collector-output (NAME &key COLLECT-NIL INITIAL-VALUE FROM-END PLACE) &body BODY
Package

collectors

Source

collectors.lisp (file)

Macro: with-collectors NAMES &body BODY

Bind multiple collectors. Each element of NAMES should be a list as per WITH-COLLECTOR’s first orgument.

Package

collectors

Source

collectors.lisp (file)

Macro: with-formatter (NAME &key DELIMITER STREAM PRETTY) &body BODY

A macro makes a function with name for body that is a string formatter see make-formatter

Package

collectors

Source

collectors.lisp (file)

Macro: with-formatter-output (NAME &key DELIMITER STREAM PRETTY) &body BODY

A macro makes a function with name for body that is a string formatter see make-formatter.
This form returns the result of that formatter

Package

collectors

Source

collectors.lisp (file)

Macro: with-mapping-appender (NAME FN-ARGS &body FN-BODY) &body BODY

Like a with-appender, but instead of a name we take a function spec

calling the function will appen

(with-mapping-appender (app (l) (mapcar #’(lambda (x) (* 2 x)) l)) (app ’(1 2))
(app ’(2 3))
(app ’(3 4))
(app)) => (2 4 4 6 6 8)

Package

collectors

Source

collectors.lisp (file)

Macro: with-mapping-collector (NAME FN-ARGS &body FN-BODY) &body BODY

Like a with-collector, but instead of a name we take a function spec

if you call the resultant function with no arguments, you get the collection so far
if you call it with arguments the results of calling your function spec are collected
(with-mapping-collector (col (x) (* 2 x))
(col 1)
(col 2)
(col 3)
(col)) => (2 4 6)

Package

collectors

Source

collectors.lisp (file)

Macro: with-reducer (NAME FUNCTION &key INITIAL-VALUE PLACE) &body BODY

Locally bind NAME to a reducing function. The arguments FUNCTION and INITIAL-VALUE are passed directly to MAKE-REDUCER.

Package

collectors

Source

collectors.lisp (file)

Macro: with-string-builder (NAME &key DELIMITER IGNORE-EMPTY-STRINGS-AND-NIL STREAM) &body BODY

A macro that creates a string builder with name in scope during the duration of the env

Package

collectors

Source

collectors.lisp (file)

Macro: with-string-builder-output (NAME &key DELIMITER IGNORE-EMPTY-STRINGS-AND-NIL STREAM) &body BODY

A macro that creates a string builder with name in scope during the duration of the env, the form returns the string that is built

Package

collectors

Source

collectors.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: make-appender &key INITIAL-VALUE PLACE-SETTER
Package

collectors

Source

collectors.lisp (file)

Function: make-collector &key INITIAL-VALUE COLLECT-NIL PLACE-SETTER
Package

collectors

Source

collectors.lisp (file)

Function: make-formatter &key DELIMITER STREAM PRETTY

Create a string formatter collector function.

creates a (lambda &optional format-string &rest args) and collects these in a list When called with no args, returns the concatenated (with delimiter) results

binds *print-pretty* to nil

Package

collectors

Source

collectors.lisp (file)

Function: make-pusher &key INITIAL-VALUE COLLECT-NIL PLACE-SETTER
Package

collectors

Source

collectors.lisp (file)

Function: make-reducer FUNCTION &key INITIAL-VALUE PLACE-SETTER
Package

collectors

Source

collectors.lisp (file)

Function: make-simple-appender &optional INITIAL-VALUE

A fastest possible, fewest frills collector suitable to places where efficiency matters that appends any values that re lists

Package

collectors

Source

collectors.lisp (file)

Function: make-simple-collector &optional INITIAL-VALUE

A fastest possible, fewest frills collector suitable to places where efficiency matters

Package

collectors

Source

collectors.lisp (file)

Function: make-string-builder &key DELIMITER IGNORE-EMPTY-STRINGS-AND-NIL STREAM
Package

collectors

Source

collectors.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Generic functions

Generic Function: after-values CONDITION
Generic Function: (setf after-values) NEW-VALUE CONDITION
Package

collectors-signals

Methods
Method: after-values (CONDITION done-aggregating)
Method: (setf after-values) NEW-VALUE (CONDITION done-aggregating)
Source

collectors.lisp (file)

Generic Function: aggregate CONDITION
Generic Function: (setf aggregate) NEW-VALUE CONDITION
Package

collectors-signals

Methods
Method: aggregate (CONDITION done-aggregating)
Method: (setf aggregate) NEW-VALUE (CONDITION done-aggregating)
Source

collectors.lisp (file)

Generic Function: aggregator CONDITION
Generic Function: (setf aggregator) NEW-VALUE CONDITION
Package

collectors-signals

Methods
Method: aggregator (CONDITION done-aggregating)
Method: (setf aggregator) NEW-VALUE (CONDITION done-aggregating)
Source

collectors.lisp (file)

Method: aggregator (CONDITION aggregating)
Method: (setf aggregator) NEW-VALUE (CONDITION aggregating)
Source

collectors.lisp (file)

Generic Function: deoperate AGGREGATOR VALUES &key TEST KEY

Undo the aggregation operation of an aggregator and list of values

Package

collectors

Source

collectors.lisp (file)

Methods
Method: deoperate (O list-aggregator) TO-REMOVE &key TEST KEY &aux PREV
Method: deoperate (O value-aggregator) VALUES &key TEST KEY &aux VALUE after
Generic Function: operate AGGREGATOR VALUES

Perform the aggregation operation on the aggregator for the values

Package

collectors

Source

collectors.lisp (file)

Methods
Method: operate (O string-builder) VALUES &aux DELIMITER OUT *PRINT-PRETTY*
Method: operate (O string-formatter) VALUES
Method: operate (O appender) VALUES
Method: operate (O collector) VALUES
Method: operate (O pusher) VALUES
Method: operate (O reducer) VALUES
Method: operate (O value-aggregator) VALUES &aux PLACES around
Generic Function: value CONDITION
Generic Function: (setf value) NEW-VALUE CONDITION
Package

collectors-signals

Methods
Method: value (VALUE-AGGREGATOR value-aggregator)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf value) NEW-VALUE (VALUE-AGGREGATOR value-aggregator)

automatically generated writer method

Source

collectors.lisp (file)

Method: value (CONDITION aggregating)
Method: (setf value) NEW-VALUE (CONDITION aggregating)
Source

collectors.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.4 Conditions

Condition: aggregating ()
Package

collectors-signals

Source

collectors.lisp (file)

Direct superclasses

condition (condition)

Direct methods
Direct slots
Slot: value
Initargs

:value

Initform

(quote nil)

Readers

value (generic function)

Writers

(setf value) (generic function)

Slot: aggregator
Initargs

:aggregator

Initform

(quote nil)

Readers

aggregator (generic function)

Writers

(setf aggregator) (generic function)

Condition: done-aggregating ()
Package

collectors-signals

Source

collectors.lisp (file)

Direct superclasses

condition (condition)

Direct methods
Direct slots
Slot: after-values
Initargs

:after-values

Initform

(quote nil)

Readers

after-values (generic function)

Writers

(setf after-values) (generic function)

Slot: aggregate
Initargs

:aggregate

Initform

(quote nil)

Readers

aggregate (generic function)

Writers

(setf aggregate) (generic function)

Slot: aggregator
Initargs

:aggregator

Initform

(quote nil)

Readers

aggregator (generic function)

Writers

(setf aggregator) (generic function)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: append-at-end-with-signals HEAD-PLACE TAIL-PLACE VALUES-PLACE AGGREGATOR-PLACE POST-VALUES-PLACE

Macros to ease efficient collection (with appending) at the end of a list

Package

collectors

Source

collectors.lisp (file)

Macro: collect-at-end-with-signals HEAD-PLACE TAIL-PLACE VALUES-PLACE AGGREGATOR-PLACE POST-VALUES-PLACE

Macros to ease efficient collection at the end of a list

Package

collectors

Source

collectors.lisp (file)

Macro: map-aggregation (AGGREGATOR FN-SPEC) &body BODY
Package

collectors

Source

collectors.lisp (file)

Macro: with-alist (NAME &key PLACE COLLECT-NIL INITIAL-VALUE FROM-END) &body BODY
Package

collectors

Source

collectors.lisp (file)

Macro: with-signal-context (VALUE AFTER-VALUES AGGREGATOR) &body BODY
Package

collectors

Source

collectors.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: mapping-aggregation-context BODY-FN &key AGGREGATOR MAP-FN
Package

collectors

Source

collectors.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: %enqueue O VALUES
Package

collectors

Methods
Method: %enqueue (O collector) VALUES
Source

collectors.lisp (file)

Method: %enqueue (O list-aggregator) VALUES &aux LAST
Source

collectors.lisp (file)

Generic Function: %pop-n O &optional N
Package

collectors

Methods
Method: %pop-n (O list-aggregator) &optional N
Source

collectors.lisp (file)

Generic Function: %push O VALUES
Package

collectors

Methods
Method: %push (O list-aggregator) VALUES
Source

collectors.lisp (file)

Generic Function: %unenqueue-n O &optional N
Package

collectors

Methods
Method: %unenqueue-n (O list-aggregator) &optional N
Source

collectors.lisp (file)

Generic Function: collect-nil? OBJECT
Generic Function: (setf collect-nil?) NEW-VALUE OBJECT
Package

collectors

Methods
Method: collect-nil? (LIST-AGGREGATOR list-aggregator)
Method: (setf collect-nil?) NEW-VALUE (LIST-AGGREGATOR list-aggregator)

Should we collect nil into our results

Source

collectors.lisp (file)

Generic Function: delimiter OBJECT
Generic Function: (setf delimiter) NEW-VALUE OBJECT
Package

collectors

Methods
Method: delimiter (STRING-FORMATTER string-formatter)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf delimiter) NEW-VALUE (STRING-FORMATTER string-formatter)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: has-written? OBJECT
Generic Function: (setf has-written?) NEW-VALUE OBJECT
Package

collectors

Methods
Method: has-written? (STRING-FORMATTER string-formatter)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf has-written?) NEW-VALUE (STRING-FORMATTER string-formatter)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: ignore-empty-strings-and-nil? OBJECT
Generic Function: (setf ignore-empty-strings-and-nil?) NEW-VALUE OBJECT
Package

collectors

Methods
Method: ignore-empty-strings-and-nil? (STRING-BUILDER string-builder)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf ignore-empty-strings-and-nil?) NEW-VALUE (STRING-BUILDER string-builder)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: initial-value OBJECT
Generic Function: (setf initial-value) NEW-VALUE OBJECT
Package

collectors

Methods
Method: initial-value (VALUE-AGGREGATOR value-aggregator)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf initial-value) NEW-VALUE (VALUE-AGGREGATOR value-aggregator)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: new-only-key OBJECT
Generic Function: (setf new-only-key) NEW-VALUE OBJECT
Package

collectors

Methods
Method: new-only-key (LIST-AGGREGATOR list-aggregator)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf new-only-key) NEW-VALUE (LIST-AGGREGATOR list-aggregator)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: new-only-test OBJECT
Generic Function: (setf new-only-test) NEW-VALUE OBJECT
Package

collectors

Methods
Method: new-only-test (LIST-AGGREGATOR list-aggregator)
Method: (setf new-only-test) NEW-VALUE (LIST-AGGREGATOR list-aggregator)

If supplied with a new-only-test, we will verify that we
have not already collected this item before collecting again

Source

collectors.lisp (file)

Generic Function: operation OBJECT
Generic Function: (setf operation) NEW-VALUE OBJECT
Package

collectors

Methods
Method: operation (REDUCER reducer)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf operation) NEW-VALUE (REDUCER reducer)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: output-stream OBJECT
Generic Function: (setf output-stream) NEW-VALUE OBJECT
Package

collectors

Methods
Method: output-stream (STRING-FORMATTER string-formatter)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf output-stream) NEW-VALUE (STRING-FORMATTER string-formatter)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: place-setter OBJECT
Generic Function: (setf place-setter) NEW-VALUE OBJECT
Package

collectors

Methods
Method: place-setter (VALUE-AGGREGATOR value-aggregator)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf place-setter) NEW-VALUE (VALUE-AGGREGATOR value-aggregator)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: pretty? OBJECT
Generic Function: (setf pretty?) NEW-VALUE OBJECT
Package

collectors

Methods
Method: pretty? (STRING-FORMATTER string-formatter)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf pretty?) NEW-VALUE (STRING-FORMATTER string-formatter)

automatically generated writer method

Source

collectors.lisp (file)

Generic Function: should-aggregate? AGGREGATOR VALUE

Should we aggregate a given value into our collection

Package

collectors

Source

collectors.lisp (file)

Methods
Method: should-aggregate? (O string-builder) V &aux COLLECT-EMPTY?
Method: should-aggregate? (O list-aggregator) V
Method: should-aggregate? (O value-aggregator) V
Generic Function: tail OBJECT
Generic Function: (setf tail) NEW-VALUE OBJECT
Package

collectors

Methods
Method: tail (COLLECTOR collector)

automatically generated reader method

Source

collectors.lisp (file)

Method: (setf tail) NEW-VALUE (COLLECTOR collector)

automatically generated writer method

Source

collectors.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Classes

Class: appender ()

Create an appender function.

An Appender will append any arguments into a list, all the values passed to it in the order in which they were passed. If the appender function is called without arguments it returns the current list of values.

Package

collectors

Source

collectors.lisp (file)

Direct superclasses

collector (class)

Direct methods

operate (method)

Class: collector ()

Create a collector function.
A Collector function will collect, into a list, all the values passed to it in the order in which they were passed. If the callector function is called without arguments it returns the current list of values.

Package

collectors

Source

collectors.lisp (file)

Direct superclasses

list-aggregator (class)

Direct subclasses

appender (class)

Direct methods
Direct slots
Slot: tail
Initargs

:tail

Readers

tail (generic function)

Writers

(setf tail) (generic function)

Class: list-aggregator ()
Package

collectors

Source

collectors.lisp (file)

Direct superclasses

value-aggregator (class)

Direct subclasses
Direct methods
Direct slots
Slot: collect-nil?

Should we collect nil into our results

Initargs

:collect-nil?

Initform

t

Readers

collect-nil? (generic function)

Writers

(setf collect-nil?) (generic function)

Slot: new-only-test

If supplied with a new-only-test, we will verify that we
have not already collected this item before collecting again

Initargs

:new-only-test

Readers

new-only-test (generic function)

Writers

(setf new-only-test) (generic function)

Slot: new-only-key
Initargs

:new-only-key

Readers

new-only-key (generic function)

Writers

(setf new-only-key) (generic function)

Class: pusher ()
Package

collectors

Source

collectors.lisp (file)

Direct superclasses

list-aggregator (class)

Direct methods

operate (method)

Class: reducer ()

Create a function which, starting with INITIAL-VALUE, reduces any other values into a single final value.

OPERATION will be called with two values: the current value and the new value, in that order. OPERATION should return exactly one value.

The reducing function can be called with n arguments which will be applied to OPERATION one after the other (left to right) and will return the new value.

If the reducing function is called with no arguments it will return the current value.

Example:

(setf r (make-reducer #’+ 5))
(funcall r 0) => 5
(funcall r 1 2) => 8
(funcall r) => 8

Package

collectors

Source

collectors.lisp (file)

Direct superclasses

value-aggregator (class)

Direct methods
Direct slots
Slot: operation
Initargs

:operation

Readers

operation (generic function)

Writers

(setf operation) (generic function)

Class: string-builder ()

Create a function that will build up a string for you
Each call to the function with arguments appends those arguments to the string with an optional delimiter between them.

if ignore-empty-strings-and-nil is true neither empty strings nor nil will be printed to the stream

A call to the function with no arguments returns the output string

Package

collectors

Source

collectors.lisp (file)

Direct superclasses

string-formatter (class)

Direct methods
Direct slots
Slot: ignore-empty-strings-and-nil?
Initargs

:ignore-empty-strings-and-nil?

Initform

t

Readers

ignore-empty-strings-and-nil? (generic function)

Writers

(setf ignore-empty-strings-and-nil?) (generic function)

Class: string-formatter ()

Create a string formatter collector function.

creates a (lambda &optional format-string &rest args) and collects these in a list When called with no args, returns the concatenated (with delimiter) results

binds *print-pretty* to nil

Package

collectors

Source

collectors.lisp (file)

Direct superclasses

value-aggregator (class)

Direct subclasses

string-builder (class)

Direct methods
Direct slots
Slot: delimiter
Initargs

:delimiter

Readers

delimiter (generic function)

Writers

(setf delimiter) (generic function)

Slot: has-written?
Initargs

:has-written?

Readers

has-written? (generic function)

Writers

(setf has-written?) (generic function)

Slot: output-stream
Initargs

:output-stream

Readers

output-stream (generic function)

Writers

(setf output-stream) (generic function)

Slot: pretty?
Initargs

:pretty?

Readers

pretty? (generic function)

Writers

(setf pretty?) (generic function)

Class: value-aggregator ()
Package

collectors

Source

collectors.lisp (file)

Direct superclasses

funcallable-standard-object (class)

Direct subclasses
Direct methods
Direct slots
Slot: initial-value
Initargs

:initial-value

Readers

initial-value (generic function)

Writers

(setf initial-value) (generic function)

Slot: place-setter
Initargs

:place-setter

Readers

place-setter (generic function)

Writers

(setf place-setter) (generic function)

Slot: value
Initargs

:value

Readers

value (generic function)

Writers

(setf value) (generic function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
collectors.asd: The collectors<dot>asd file
collectors/collectors.lisp: The collectors/collectors<dot>lisp file

F
File, Lisp, collectors.asd: The collectors<dot>asd file
File, Lisp, collectors/collectors.lisp: The collectors/collectors<dot>lisp file

L
Lisp File, collectors.asd: The collectors<dot>asd file
Lisp File, collectors/collectors.lisp: The collectors/collectors<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
A   C   D   F   G   H   I   M   N   O   P   S   T   V   W  
Index Entry  Section

%
%enqueue: Internal generic functions
%enqueue: Internal generic functions
%enqueue: Internal generic functions
%pop-n: Internal generic functions
%pop-n: Internal generic functions
%push: Internal generic functions
%push: Internal generic functions
%unenqueue-n: Internal generic functions
%unenqueue-n: Internal generic functions

(
(setf after-values): Exported generic functions
(setf after-values): Exported generic functions
(setf aggregate): Exported generic functions
(setf aggregate): Exported generic functions
(setf aggregator): Exported generic functions
(setf aggregator): Exported generic functions
(setf aggregator): Exported generic functions
(setf collect-nil?): Internal generic functions
(setf collect-nil?): Internal generic functions
(setf delimiter): Internal generic functions
(setf delimiter): Internal generic functions
(setf has-written?): Internal generic functions
(setf has-written?): Internal generic functions
(setf ignore-empty-strings-and-nil?): Internal generic functions
(setf ignore-empty-strings-and-nil?): Internal generic functions
(setf initial-value): Internal generic functions
(setf initial-value): Internal generic functions
(setf new-only-key): Internal generic functions
(setf new-only-key): Internal generic functions
(setf new-only-test): Internal generic functions
(setf new-only-test): Internal generic functions
(setf operation): Internal generic functions
(setf operation): Internal generic functions
(setf output-stream): Internal generic functions
(setf output-stream): Internal generic functions
(setf place-setter): Internal generic functions
(setf place-setter): Internal generic functions
(setf pretty?): Internal generic functions
(setf pretty?): Internal generic functions
(setf tail): Internal generic functions
(setf tail): Internal generic functions
(setf value): Exported generic functions
(setf value): Exported generic functions
(setf value): Exported generic functions

A
after-values: Exported generic functions
after-values: Exported generic functions
aggregate: Exported generic functions
aggregate: Exported generic functions
aggregator: Exported generic functions
aggregator: Exported generic functions
aggregator: Exported generic functions
append-at-end: Exported macros
append-at-end-with-signals: Internal macros
appending: Exported macros

C
collect-at-end: Exported macros
collect-at-end-with-signals: Internal macros
collect-nil?: Internal generic functions
collect-nil?: Internal generic functions
collecting: Exported macros

D
delimiter: Internal generic functions
delimiter: Internal generic functions
deoperate: Exported generic functions
deoperate: Exported generic functions
deoperate: Exported generic functions

F
Function, make-appender: Exported functions
Function, make-collector: Exported functions
Function, make-formatter: Exported functions
Function, make-pusher: Exported functions
Function, make-reducer: Exported functions
Function, make-simple-appender: Exported functions
Function, make-simple-collector: Exported functions
Function, make-string-builder: Exported functions
Function, mapping-aggregation-context: Internal functions

G
Generic Function, %enqueue: Internal generic functions
Generic Function, %pop-n: Internal generic functions
Generic Function, %push: Internal generic functions
Generic Function, %unenqueue-n: Internal generic functions
Generic Function, (setf after-values): Exported generic functions
Generic Function, (setf aggregate): Exported generic functions
Generic Function, (setf aggregator): Exported generic functions
Generic Function, (setf collect-nil?): Internal generic functions
Generic Function, (setf delimiter): Internal generic functions
Generic Function, (setf has-written?): Internal generic functions
Generic Function, (setf ignore-empty-strings-and-nil?): Internal generic functions
Generic Function, (setf initial-value): Internal generic functions
Generic Function, (setf new-only-key): Internal generic functions
Generic Function, (setf new-only-test): Internal generic functions
Generic Function, (setf operation): Internal generic functions
Generic Function, (setf output-stream): Internal generic functions
Generic Function, (setf place-setter): Internal generic functions
Generic Function, (setf pretty?): Internal generic functions
Generic Function, (setf tail): Internal generic functions
Generic Function, (setf value): Exported generic functions
Generic Function, after-values: Exported generic functions
Generic Function, aggregate: Exported generic functions
Generic Function, aggregator: Exported generic functions
Generic Function, collect-nil?: Internal generic functions
Generic Function, delimiter: Internal generic functions
Generic Function, deoperate: Exported generic functions
Generic Function, has-written?: Internal generic functions
Generic Function, ignore-empty-strings-and-nil?: Internal generic functions
Generic Function, initial-value: Internal generic functions
Generic Function, new-only-key: Internal generic functions
Generic Function, new-only-test: Internal generic functions
Generic Function, operate: Exported generic functions
Generic Function, operation: Internal generic functions
Generic Function, output-stream: Internal generic functions
Generic Function, place-setter: Internal generic functions
Generic Function, pretty?: Internal generic functions
Generic Function, should-aggregate?: Internal generic functions
Generic Function, tail: Internal generic functions
Generic Function, value: Exported generic functions

H
has-written?: Internal generic functions
has-written?: Internal generic functions

I
ignore-empty-strings-and-nil?: Internal generic functions
ignore-empty-strings-and-nil?: Internal generic functions
initial-value: Internal generic functions
initial-value: Internal generic functions

M
Macro, append-at-end: Exported macros
Macro, append-at-end-with-signals: Internal macros
Macro, appending: Exported macros
Macro, collect-at-end: Exported macros
Macro, collect-at-end-with-signals: Internal macros
Macro, collecting: Exported macros
Macro, make-simple-appender-to-place: Exported macros
Macro, make-simple-collector-to-place: Exported macros
Macro, map-aggregation: Internal macros
Macro, with-alist: Internal macros
Macro, with-alist-output: Exported macros
Macro, with-appender: Exported macros
Macro, with-appender-output: Exported macros
Macro, with-collector: Exported macros
Macro, with-collector-output: Exported macros
Macro, with-collectors: Exported macros
Macro, with-formatter: Exported macros
Macro, with-formatter-output: Exported macros
Macro, with-mapping-appender: Exported macros
Macro, with-mapping-collector: Exported macros
Macro, with-reducer: Exported macros
Macro, with-signal-context: Internal macros
Macro, with-string-builder: Exported macros
Macro, with-string-builder-output: Exported macros
make-appender: Exported functions
make-collector: Exported functions
make-formatter: Exported functions
make-pusher: Exported functions
make-reducer: Exported functions
make-simple-appender: Exported functions
make-simple-appender-to-place: Exported macros
make-simple-collector: Exported functions
make-simple-collector-to-place: Exported macros
make-string-builder: Exported functions
map-aggregation: Internal macros
mapping-aggregation-context: Internal functions
Method, %enqueue: Internal generic functions
Method, %enqueue: Internal generic functions
Method, %pop-n: Internal generic functions
Method, %push: Internal generic functions
Method, %unenqueue-n: Internal generic functions
Method, (setf after-values): Exported generic functions
Method, (setf aggregate): Exported generic functions
Method, (setf aggregator): Exported generic functions
Method, (setf aggregator): Exported generic functions
Method, (setf collect-nil?): Internal generic functions
Method, (setf delimiter): Internal generic functions
Method, (setf has-written?): Internal generic functions
Method, (setf ignore-empty-strings-and-nil?): Internal generic functions
Method, (setf initial-value): Internal generic functions
Method, (setf new-only-key): Internal generic functions
Method, (setf new-only-test): Internal generic functions
Method, (setf operation): Internal generic functions
Method, (setf output-stream): Internal generic functions
Method, (setf place-setter): Internal generic functions
Method, (setf pretty?): Internal generic functions
Method, (setf tail): Internal generic functions
Method, (setf value): Exported generic functions
Method, (setf value): Exported generic functions
Method, after-values: Exported generic functions
Method, aggregate: Exported generic functions
Method, aggregator: Exported generic functions
Method, aggregator: Exported generic functions
Method, collect-nil?: Internal generic functions
Method, delimiter: Internal generic functions
Method, deoperate: Exported generic functions
Method, deoperate: Exported generic functions
Method, has-written?: Internal generic functions
Method, ignore-empty-strings-and-nil?: Internal generic functions
Method, initial-value: Internal generic functions
Method, new-only-key: Internal generic functions
Method, new-only-test: Internal generic functions
Method, operate: Exported generic functions
Method, operate: Exported generic functions
Method, operate: Exported generic functions
Method, operate: Exported generic functions
Method, operate: Exported generic functions
Method, operate: Exported generic functions
Method, operate: Exported generic functions
Method, operation: Internal generic functions
Method, output-stream: Internal generic functions
Method, place-setter: Internal generic functions
Method, pretty?: Internal generic functions
Method, should-aggregate?: Internal generic functions
Method, should-aggregate?: Internal generic functions
Method, should-aggregate?: Internal generic functions
Method, tail: Internal generic functions
Method, value: Exported generic functions
Method, value: Exported generic functions

N
new-only-key: Internal generic functions
new-only-key: Internal generic functions
new-only-test: Internal generic functions
new-only-test: Internal generic functions

O
operate: Exported generic functions
operate: Exported generic functions
operate: Exported generic functions
operate: Exported generic functions
operate: Exported generic functions
operate: Exported generic functions
operate: Exported generic functions
operate: Exported generic functions
operation: Internal generic functions
operation: Internal generic functions
output-stream: Internal generic functions
output-stream: Internal generic functions

P
place-setter: Internal generic functions
place-setter: Internal generic functions
pretty?: Internal generic functions
pretty?: Internal generic functions

S
should-aggregate?: Internal generic functions
should-aggregate?: Internal generic functions
should-aggregate?: Internal generic functions
should-aggregate?: Internal generic functions

T
tail: Internal generic functions
tail: Internal generic functions

V
value: Exported generic functions
value: Exported generic functions
value: Exported generic functions

W
with-alist: Internal macros
with-alist-output: Exported macros
with-appender: Exported macros
with-appender-output: Exported macros
with-collector: Exported macros
with-collector-output: Exported macros
with-collectors: Exported macros
with-formatter: Exported macros
with-formatter-output: Exported macros
with-mapping-appender: Exported macros
with-mapping-collector: Exported macros
with-reducer: Exported macros
with-signal-context: Internal macros
with-string-builder: Exported macros
with-string-builder-output: Exported macros

Jump to:   %   (  
A   C   D   F   G   H   I   M   N   O   P   S   T   V   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   A   C   D   H   I   N   O   P   S   T   V  
Index Entry  Section

A
after-values: Exported conditions
aggregate: Exported conditions
aggregator: Exported conditions
aggregator: Exported conditions

C
collect-nil?: Internal classes

D
delimiter: Internal classes

H
has-written?: Internal classes

I
ignore-empty-strings-and-nil?: Internal classes
initial-value: Internal classes

N
new-only-key: Internal classes
new-only-test: Internal classes

O
operation: Internal classes
output-stream: Internal classes

P
place-setter: Internal classes
pretty?: Internal classes

S
Slot, after-values: Exported conditions
Slot, aggregate: Exported conditions
Slot, aggregator: Exported conditions
Slot, aggregator: Exported conditions
Slot, collect-nil?: Internal classes
Slot, delimiter: Internal classes
Slot, has-written?: Internal classes
Slot, ignore-empty-strings-and-nil?: Internal classes
Slot, initial-value: Internal classes
Slot, new-only-key: Internal classes
Slot, new-only-test: Internal classes
Slot, operation: Internal classes
Slot, output-stream: Internal classes
Slot, place-setter: Internal classes
Slot, pretty?: Internal classes
Slot, tail: Internal classes
Slot, value: Exported conditions
Slot, value: Internal classes

T
tail: Internal classes

V
value: Exported conditions
value: Internal classes

Jump to:   A   C   D   H   I   N   O   P   S   T   V  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   A   C   D   L   P   R   S   V  
Index Entry  Section

A
aggregating: Exported conditions
appender: Internal classes

C
Class, appender: Internal classes
Class, collector: Internal classes
Class, list-aggregator: Internal classes
Class, pusher: Internal classes
Class, reducer: Internal classes
Class, string-builder: Internal classes
Class, string-formatter: Internal classes
Class, value-aggregator: Internal classes
collector: Internal classes
collectors: The collectors system
collectors: The collectors package
collectors-signals: The collectors-signals package
collectors.system: The collectors<dot>system package
Condition, aggregating: Exported conditions
Condition, done-aggregating: Exported conditions

D
done-aggregating: Exported conditions

L
list-aggregator: Internal classes

P
Package, collectors: The collectors package
Package, collectors-signals: The collectors-signals package
Package, collectors.system: The collectors<dot>system package
pusher: Internal classes

R
reducer: Internal classes

S
string-builder: Internal classes
string-formatter: Internal classes
System, collectors: The collectors system

V
value-aggregator: Internal classes

Jump to:   A   C   D   L   P   R   S   V