The simpsamp Reference Manual

Table of Contents

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

The simpsamp Reference Manual

This is the simpsamp Reference Manual, version 0.1, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:34:55 2018 GMT+0.


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

1 Introduction

Please see "doc/doc.html" or "doc/doc.txt" for documentation.


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 simpsamp

Maintainer

J.P. Larocque

Author

J.P. Larocque

License

ISC-style permissive

Description

Fast algorithms for simple random sampling from sets, without replacement.

Version

0.1

Dependency

jpl-util (at least version 0.2)

Source

simpsamp.asd (file)

Components

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 simpsamp.asd

Location

simpsamp.asd

Systems

simpsamp (system)


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

3.1.2 simpsamp/core.lisp

Dependency

package.lisp (file)

Parent

simpsamp (system)

Location

core.lisp

Exported Definitions

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

3.1.3 simpsamp/input.lisp

Dependency

package.lisp (file)

Parent

simpsamp (system)

Location

input.lisp

Internal Definitions

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

3.1.4 simpsamp/output.lisp

Dependency

package.lisp (file)

Parent

simpsamp (system)

Location

output.lisp

Internal Definitions

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

3.1.5 simpsamp/out-do.lisp

Dependencies
Parent

simpsamp (system)

Location

out-do.lisp

Exported Definitions

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

3.1.6 simpsamp/out-map.lisp

Dependencies
Parent

simpsamp (system)

Location

out-map.lisp

Exported Definitions

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

3.1.7 simpsamp/out-list.lisp

Dependencies
Parent

simpsamp (system)

Location

out-list.lisp

Exported Definitions

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

3.1.8 simpsamp/out-vector.lisp

Dependencies
Parent

simpsamp (system)

Location

out-vector.lisp

Exported Definitions

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

3.1.9 simpsamp/out-hash-table.lisp

Dependencies
Parent

simpsamp (system)

Location

out-hash-table.lisp

Exported Definitions

hash-table-sample-of-hash-table (function)


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

3.1.10 simpsamp/unbounded-iterator.lisp

Dependencies
Parent

simpsamp (system)

Location

unbounded-iterator.lisp

Exported Definitions

vector-sample-of-unbounded-iterator (function)


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

3.1.11 simpsamp/generic-functions.lisp

Dependencies
Parent

simpsamp (system)

Location

generic-functions.lisp

Exported Definitions
Internal Definitions

define-typical-sample-methods (macro)


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

3.1.12 simpsamp/test.lisp

Dependencies
Parent

simpsamp (system)

Location

test.lisp

Exported Definitions

test (function)


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

3.1.13 simpsamp/test-core.lisp

Dependencies
Parent

simpsamp (system)

Location

test-core.lisp

Internal Definitions

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

3.1.14 simpsamp/test-outputs.lisp

Dependencies
Parent

simpsamp (system)

Location

test-outputs.lisp

Internal Definitions

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

3.1.15 simpsamp/package.lisp

Parent

simpsamp (system)

Location

package.lisp

Packages

simpsamp


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

4 Packages

Packages are listed by definition order.


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

4.1 simpsamp

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal 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: do-sample-of-hash-table (KEY-VAR VALUE-VAR N-FORM HASH-TABLE-FORM &rest KW-ARGS &key &allow-other-keys) &body BODY
Package

simpsamp

Source

out-do.lisp (file)

Macro: do-sample-of-iterator (VARS N-FORM SIZE-FORM NEXT-FN-FORM &rest KW-ARGS &key &allow-other-keys) &body BODY
Package

simpsamp

Source

out-do.lisp (file)

Macro: do-sample-of-iterator-expr (VARS N-FORM SIZE-FORM NEXT-FORM &key EFFECTIVE-N-VAR INITIAL-FORM RESULT-FORM) &body BODY

Iterates over a simple random sample of N-FORM elements, without replacement, from a set expressed by SIZE-FORM and NEXT-FORM.

N-FORM is evaluated once, before any other arguments are evaluated. If the value of N-FORM is larger than the size of the input set, then the resulting sample will just contain all the elements of the set–that is, the value of N-FORM is automatically lowered to the size of the input set when necessary.

SIZE-FORM is then evaluated once to produce the number of elements in the set.

When INITIAL-FORM is given, it is evaluated before iteration begins. When RESULT-FORM is given, it is evaluated after iteration ends, and its resulting values become the result of the iteration form; if RESULT-FORM is not given, the result is NIL. If EFFECTIVE-N-VAR is given, it is bound with the effective number of elements to process (the result of N-FORM limited by the actual size of the input set) for the evaluation of INITIAL-FORM, NEXT-FORM, RESULT-FORM, and BODY.

NEXT-FORM is evaluated to produce the next available element, advancing through the set. NEXT-FORM may produce multiple values; these values taken together as a tuple constitute a single element of the set. NEXT-FORM will never be evaluated more times than the value of SIZE-FORM.

For each element selected for the random sample, BODY is evaluated with the symbol specified by VARS bound to a list of each value of the element (the values yielded by NEXT-FORM). Alternatively, VARS may be a list of symbols, each of which is bound to each successive value of the element, as if by MULTIPLE-VALUE-BIND. In either case, the bindings may be shared between different iterations, or the binding may be fresh each time.

An implicit block named NIL is established around the loop. RETURN may be used to terminate the loop prematurely, overriding the default resulting values of the iteration form (controlled by RESULT-FORM).

The order in which BODY is evaluated on the sampled elements is not assured to be random. The only thing that is random is which selection is made of all the possible subsets of the input set with the size expressed by N-FORM.

Package

simpsamp

Source

core.lisp (file)

Macro: do-sample-of-list (VAR N-FORM LIST-FORM &rest KW-ARGS &key &allow-other-keys) &body BODY
Package

simpsamp

Source

out-do.lisp (file)

Macro: do-sample-of-range (VAR N-FORM LOWER-FORM UPPER-FORM &rest KW-ARGS &key &allow-other-keys) &body BODY
Package

simpsamp

Source

out-do.lisp (file)

Macro: do-sample-of-unbounded-iterator (VAR N-FORM NEXT-FN-FORM EXHAUSTED?-FN-FORM &key EFFECTIVE-N-VAR INITIAL-FORM RESULT-FORM) &body BODY
Package

simpsamp

Source

out-do.lisp (file)

Macro: do-sample-of-vector (VAR N-FORM VECTOR-FORM &rest KW-ARGS &key &allow-other-keys) &body BODY
Package

simpsamp

Source

out-do.lisp (file)

Macro: vector-sample-of-unbounded-iterator-expr N-FORM NEXT-FORM EXHAUSTED?-FORM

Evaluates to a simple random sample of size N-FORM, without replacement, from a set of unknown size expressed by NEXT-FORM and EXHAUSTED?-FORM. The resulting sample is expressed as a vector.

N-FORM is evaluated once, before any other arguments are evaluated. If the value of N-FORM is larger than the size of the input set, then the resulting sample will just contain all the elements of the set–that is, the value of N-FORM is automatically lowered to the size of the input set when necessary. The value of N-FORM (before being limited by the size of the input set) must be within the host implementation’s ARRAY-DIMENSION-LIMIT.

NEXT-FORM is evaluated to produce the next available element, advancing through the input set. (Its first return value is used as the element, or NIL if NEXT-FORM produced no values.) EXHAUSTED?-FORM is evaluated to produce a generalized boolean indicating whether the input set has been exhausted. NEXT-FORM will never be evaluated unless EXHAUSTED?-FORM has been evaluated since the last evaluation of NEXT-FORM, and the result was false.

The order of the returned elements is not assured to be random. The only thing that is random is which selection is made of all the possible subsets of the input set with the size expressed by N-FORM.

Package

simpsamp

Source

core.lisp (file)


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

5.1.2 Functions

Function: hash-table-sample-of-hash-table N HASH-TABLE
Package

simpsamp

Source

out-hash-table.lisp (file)

Function: list-sample-of-hash-table-keys N HASH-TABLE
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-hash-table-pairs N HASH-TABLE
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-hash-table-values N HASH-TABLE
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-iterator N SIZE NEXT-FN
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-list N LIST
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-range N LOWER UPPER
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-unbounded-iterator N NEXT-FN EXHAUSTED?-FN
Package

simpsamp

Source

out-list.lisp (file)

Function: list-sample-of-vector N VECTOR
Package

simpsamp

Source

out-list.lisp (file)

Function: map-sample-of-hash-table FUNCTION N HASH-TABLE
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-hash-table-keys FUNCTION N HASH-TABLE
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-hash-table-values FUNCTION N HASH-TABLE
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-iterator FUNCTION N SIZE NEXT-FN
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-list FUNCTION N LIST
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-range FUNCTION N LOWER UPPER
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-unbounded-iterator FUNCTION N NEXT-FN EXHAUSTED?-FN
Package

simpsamp

Source

out-map.lisp (file)

Function: map-sample-of-vector FUNCTION N VECTOR
Package

simpsamp

Source

out-map.lisp (file)

Function: test &rest TEST-CORE-ARGS &key STREAM &allow-other-keys
Package

simpsamp

Source

test.lisp (file)

Function: vector-sample-of-hash-table-keys N HASH-TABLE
Package

simpsamp

Source

out-vector.lisp (file)

Function: vector-sample-of-hash-table-pairs N HASH-TABLE
Package

simpsamp

Source

out-vector.lisp (file)

Function: vector-sample-of-hash-table-values N HASH-TABLE
Package

simpsamp

Source

out-vector.lisp (file)

Function: vector-sample-of-iterator N SIZE NEXT-FN
Package

simpsamp

Source

out-vector.lisp (file)

Function: vector-sample-of-list N LIST
Package

simpsamp

Source

out-vector.lisp (file)

Function: vector-sample-of-range N LOWER UPPER
Package

simpsamp

Source

out-vector.lisp (file)

Function: vector-sample-of-unbounded-iterator N NEXT-FN EXHAUSTED?-FN
Package

simpsamp

Source

unbounded-iterator.lisp (file)

Function: vector-sample-of-vector N VECTOR
Package

simpsamp

Source

out-vector.lisp (file)


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

5.1.3 Generic functions

Generic Function: list-sample N SET

Like SAMPLE, but the result is a LIST.

Package

simpsamp

Source

generic-functions.lisp (file)

Methods
Method: list-sample (N integer) (SET hash-table)
Method: list-sample (N integer) (SET vector)
Method: list-sample (N integer) (SET list)
Generic Function: map-sample FUNCTION N SET

Like SAMPLE, but applies FUNCTION to each element
of the resulting selection.

When SET is a mapping type (e.g. a HASH-TABLE), FUNCTION is applied with two arguments: the key and the value.

Package

simpsamp

Source

generic-functions.lisp (file)

Methods
Method: map-sample FUNCTION (N integer) (SET hash-table)
Method: map-sample FUNCTION (N integer) (SET vector)
Method: map-sample FUNCTION (N integer) (SET list)
Generic Function: sample N SET

Returns a simple random sample of size N, without
replacement, from SET. The output will be of type SEQUENCE. (Whether a LIST is returned or a VECTOR depends on which is most efficient for the type of SET.)

If N is larger than the size of SET, then the resulting sample will just contain all the elements of SET–that is, N is automatically lowered to the size of SET when necessary.

When SET is a mapping type (e.g. a HASH-TABLE), the returned elements will be CONSes of the form (KEY . VALUE).

The order of the returned elements is not assured to be random. The only thing that is random is which selection is made of all the possible subsets of SET of size N.

Package

simpsamp

Source

generic-functions.lisp (file)

Methods
Method: sample (N integer) (SET hash-table)
Method: sample (N integer) (SET vector)
Method: sample (N integer) (SET list)
Generic Function: vector-sample N SET

Like SAMPLE, but the result is a VECTOR.

Package

simpsamp

Source

generic-functions.lisp (file)

Methods
Method: vector-sample (N integer) (SET hash-table)
Method: vector-sample (N integer) (SET vector)
Method: vector-sample (N integer) (SET list)

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

5.2 Internal definitions


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

5.2.1 Special variables

Special Variable: *test-output-lower-bound*
Package

simpsamp

Source

test-outputs.lisp (file)

Special Variable: *test-output-upper-bound*
Package

simpsamp

Source

test-outputs.lisp (file)


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

5.2.2 Macros

Macro: define-typical-sample-methods SPECIALIZED-FOR-CLASS-NAME GENERIC-SAMPLE-FUNCTION-NAME LIST-SAMPLE-FUNCTION-NAME VECTOR-SAMPLE-FUNCTION-NAME MAP-SAMPLE-FUNCTION-NAME
Package

simpsamp

Source

generic-functions.lisp (file)

Macro: test-accumulated-sample (LABEL ACCUMULATE INPUT-SET-FORM REQUESTED-SAMPLE-SIZE-FORM) &body BODY

Evaluates BODY, which accumulates the elements of a sample taken from a set. After evaluating BODY, tests the sample against the input set and the requested sample size. If there is an error in the resulting sample, an error is signalled. LABEL is included in any error messages.

ACCUMULATE is defined with MACROLET for the evaluation of BODY. (ACCUMULATE ELEMENT) is used to accumulate each ELEMENT of the sample that is taken.

INPUT-SET-FORM is evaluated to produce the input set (or an equivalent copy), as a SEQUENCE.

REQUESTED-SAMPLE-SIZE-FORM is evaluated to produce the requested size of the sample to take.

Note that the input set and requested sample size are not passed to anything within BODY, but must be equivalent to the corresponding arguments to the function or macro form used in BODY to produce the sample.

Package

simpsamp

Source

test-outputs.lisp (file)

Macro: test-do-sample (LABEL ACCUMULATE INITIAL-FORM RESULT-FORM INITIAL-SET-FORM REQUESTED-SAMPLE-SIZE-FORM) &body BODY

Evaluates BODY, which iterates over the elements of a sample taken from a set. After evaluating BODY, tests the sample against the input set and the requested sample size. If there is an error in the resulting sample, an error is signalled. LABEL is included in any error messages.

ACCUMULATE is defined with MACROLET for the evaluation of BODY. The result of BODY must be the result a DO-SAMPLE-OF-* macro form that includes at least the expression (ACCUMULATE ELEMENT) in its body (where ELEMENT is the variable naming the current element in the loop over the resulting sample). BODY should consist solely of the DO-SAMPLE-OF-* macro form, and the body of that macro form should consist solely of (ACCUMULATE ELEMENT).

INITIAL-FORM is defined with MACROLET for the evaluation of BODY. (INITIAL-FORM) must be the :INITIAL-FORM argument to the DO-SAMPLE-OF-* macro form.

RESULT-FORM is defined with MACROLET for the evaluation of BODY. (RESULT-FORM) must be the :RESULT-FORM argument to the DO-SAMPLE-OF-* macro form.

INPUT-SET-FORM is evaluated to produce the input set (or an equivalent copy), as a SEQUENCE.

REQUESTED-SAMPLE-SIZE-FORM is evaluated to produce the requested size of the sample to take.

Note that the input set and requested sample size are not passed to anything within BODY, but must be equivalent to the corresponding arguments to the DO-SAMPLE-OF-* macro form used in BODY to produce the sample.

Package

simpsamp

Source

test-outputs.lisp (file)

Macro: test-list-sample (LABEL INPUT-SET-FORM REQUESTED-SAMPLE-SIZE-FORM) &body BODY

Evaluates BODY, which takes a sample from a set, evaluating to the sample (as a LIST). The sample is tested against the input set and the requested sample size. If there is an error in the resulting sample, an error is signalled. LABEL is included in any error messages.

INPUT-SET-FORM and REQUESTED-SAMPLE-SIZE-FORM have the same meaning as they do in the TEST-ACCUMULATED-SAMPLE macro.

Package

simpsamp

Source

test-outputs.lisp (file)

Macro: test-vector-sample (LABEL INPUT-SET-FORM REQUESTED-SAMPLE-SIZE-FORM) &body BODY

Evaluates BODY, which takes a sample from a set, evaluating to the sample (as a VECTOR). The sample is tested against the input set and the requested sample size. If there is an error in the resulting sample, an error is signalled. LABEL is included in any error messages.

INPUT-SET-FORM and REQUESTED-SAMPLE-SIZE-FORM have the same meaning as they do in the TEST-ACCUMULATED-SAMPLE macro.

Package

simpsamp

Source

test-outputs.lisp (file)

Macro: with-hash-table-accumulator (SET-TEST/SIZE ACCUMULATE) &body BODY

Evaluates BODY, accumulating keys and values to a hash-table, resulting in the hash-table.

SET-TEST/SIZE is defined with MACROLET. (SET-TEST/SIZE TEST SIZE) must be evaluated once, before accumulation begins. TEST must be an acceptable hash-table test function for MAKE-HASH-TABLE. SIZE must be a non-negative integer indicating the expected final size of the hash-table (the number of times ACCUMULATE is evaluated with a unique KEY), which need not be accurate, or NIL to make no guess as to the final size.

ACCUMULATE is defined with MACROLET. Each time (ACCUMULATE KEY VALUE) is evaluated, KEY and TABLE are added as an entry to the hash-table, replacing any previous entry with the same KEY.

Package

simpsamp

Source

output.lisp (file)

Macro: with-list-accumulator (ACCUMULATE) &body BODY

Evaluates BODY, accumulating elements to a list, resulting in the list. The order of the elements of the resulting list is undefined.

ACCUMULATE is defined with MACROLET. Each time (ACCUMULATE ELEMENT) is evaluated, ELEMENT is accumulated to the list.

Package

simpsamp

Source

output.lisp (file)

Macro: with-list-iterator (NEXT SIZE EXHAUSTED? LIST-FORM) &body BODY

Evaluates BODY with an iterator on a list.

LIST-FORM is evaluated once to produce the list to iterate upon. The resulting list is never modified (unless from within BODY), the consequences of which are undefined).

NEXT is defined with MACROLET. Each evaluation of (NEXT) yields the next successive element of the list.

SIZE is defined with MACROLET. Each evaluation of (SIZE) yields the length of the list. The length may or may not be calculated upon each evaluation; it may (but need not be) be memoized.

EXHAUSTED? is defined with MACROLET?. Each evaluation of (EXHAUSTED?) yields a generalized boolean indicating whether the list has been exhausted by evaluations of NEXT.

The effect of calling NEXT more times than the length of the list is undefined.

Package

simpsamp

Source

input.lisp (file)

Macro: with-range-iterator (NEXT SIZE EXHAUSTED? LOWER-FORM UPPER-FORM) &body BODY

Evaluates BODY with an iterator on a range of integers.

LOWER-FORM and UPPER-FORM are evaluated once to produce the range of integers, [LOWER,UPPER), to iterate upon.

NEXT is defined with MACROLET. Each evaluation of (NEXT) yields the next successive element of the range.

SIZE is defined with MACROLET. Each evaluation of (SIZE) yields the length of the range.

EXHAUSTED? is defined with MACROLET?. Each evaluation of (EXHAUSTED?) yields a generalized boolean indicating whether the range has been exhausted by evaluations of NEXT.

The effect of calling NEXT more times than the length of the range is undefined.

Package

simpsamp

Source

input.lisp (file)

Macro: with-vector-accumulator (SET-SIZE/ELEMENT-TYPE ACCUMULATE) &body BODY

Evaluates BODY, accumulating elements to a vector, resulting in the vector. The order of the elements of the resulting vector is undefined.

SET-SIZE/ELEMENT-TYPE is defined with
MACROLET. (SET-SIZE/ELEMENT-TYPE SIZE ELEMENT-TYPE) must be evaluated once, before accumulation begins. SIZE dictates the size of the resulting vector. ELEMENT-TYPE is a designator for the type of elements to be accumulated. The result of accumulating an element not of type ELEMENT-TYPE is undefined.

ACCUMULATE is defined with MACROLET. Each time (ACCUMULATE ELEMENT) is evaluated, ELEMENT is accumulated to the vector. It must be evaluated exactly the number of times as given to the SET-SIZE/ELEMENT-TYPE form before control leaves BODY in the normal manner. (It’s acceptable for control to leave BODY due to non-local exits, such as GO, THROW, or a signalled condition.)

Package

simpsamp

Source

output.lisp (file)

Macro: with-vector-iterator (NEXT SIZE EXHAUSTED? VECTOR-FORM) &body BODY

Evaluates BODY with an iterator on a vector.

VECTOR-FORM is evaluated once to produce the vector to iterate upon. The resulting vector is never modified (unless from within BODY, the consequences of which are undefined).

NEXT is defined with MACROLET. Each evaluation of (NEXT) yields the next successive element of the vector.

SIZE is defined with MACROLET. Each evaluation of (SIZE) yields the length of the vector.

EXHAUSTED? is defined with MACROLET?. Each evaluation of (EXHAUSTED?) yields a generalized boolean indicating whether the vector has been exhausted by evaluations of NEXT.

The effect of calling NEXT more times than the length of the vector is undefined.

Package

simpsamp

Source

input.lisp (file)


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

5.2.3 Functions

Function: list->hash-table LIST

Given LIST, a list of 2-lists of the form (KEY VALUE), returns a hash table mapping each KEY to each corresponding VALUE.

Package

simpsamp

Source

test-outputs.lisp (file)

Function: list->iterator-mv LIST

Returns two values: the length of LIST and a function that successively returns the lists of LIST as multiple values.

Package

simpsamp

Source

test-outputs.lisp (file)

Function: list->unbounded-iterator LIST

Returns two values: a function that successively returns the values of LIST, and a function that returns a generalized boolean indicating whether the first function has exhausted LIST.

Package

simpsamp

Source

test-outputs.lisp (file)

Function: make-test-set-as-list ()

Returns a sample set (as a list) of lists, each list consisting of two elements.

Package

simpsamp

Source

test-outputs.lisp (file)

Function: make-test-set-as-range ()

Returns three values to use as a range set: a lower bound, an upper bound, and a list of the values of the range.

Package

simpsamp

Source

test-outputs.lisp (file)

Function: make-test-set-as-vector ()

Returns the sample set from MAKE-TEST-SET-AS-LIST, but as a vector.

Package

simpsamp

Source

test-outputs.lisp (file)

Function: measure-selection-rates ITERATIONS SET-LOWER SET-UPPER SAMPLE-SIZE SAMPLE-FN

Given the set of integers [SET-LOWER,SET-UPPER), measures the selection rates of each element when repeatedly given to SAMPLE-FN, which takes a simple random sample, without replacement, of the set. SAMPLE-SIZE is the size of each sample.

The function SAMPLE-FN is called ITERATIONS times. Its arguments are:

SAMPLE-SIZE
The requested size of the sample to take of the set.

SET-SIZE
The size of the set.

SET-NEXT
A function of no arguments returning the next element of the set.

SET-EXHAUSTED?
A function of no arguments returning a generalized boolean indicating whether the set has been exhausted.

VISIT-SAMPLE-ELEMENT
A function which must be called once for every element of the chosen sample.

Returns two values: the expected rate of selection for all elements, based on the set size and sample size, and a vector of the actual measured rate of selection for each element of the set; each element of the vector corresponds to [SET-LOWER,SET-UPPER) (in the same order).

The more any actual rate varies from the expected rate, the more likely there was some bias or error in the sample taken by SAMPLE-FN. A lower number of iterations can also cause this problem; 1,000,000 is a good number of iterations to use to get a clear reading.

Package

simpsamp

Source

test-core.lisp (file)

Function: report-selection-rates LABEL EXPECTED-RATE ACTUAL-RATES VERBOSE-P STREAM

Reports EXPECTED-RATE and some trivial statistics on ACTUAL-RATES, as returned by MEASURE-SELECTION-RATES. Prints the analysis to STREAM.

When VERBOSE-P is true, prints each element of ACTUAL-RATES, along with its error from EXPECTED-RATE and a graph of its error.

Package

simpsamp

Source

test-core.lisp (file)

Function: test-computed-sample LABEL SAMPLE SAMPLE-TYPE INPUT-SET REQUESTED-SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-core &key ITERATIONS SET-LOWER SET-UPPER SAMPLE-SIZE STREAM VERBOSE-P
Package

simpsamp

Source

test-core.lisp (file)

Function: test-output ()
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-output-as-hash-table SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-output-as-iteration SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-output-as-list SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-output-as-mapping SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-output-as-vector SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)

Function: test-output-methods SAMPLE-SIZE
Package

simpsamp

Source

test-outputs.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   S  
Index Entry  Section

F
File, Lisp, simpsamp.asd: The simpsamp<dot>asd file
File, Lisp, simpsamp/core.lisp: The simpsamp/core<dot>lisp file
File, Lisp, simpsamp/generic-functions.lisp: The simpsamp/generic-functions<dot>lisp file
File, Lisp, simpsamp/input.lisp: The simpsamp/input<dot>lisp file
File, Lisp, simpsamp/out-do.lisp: The simpsamp/out-do<dot>lisp file
File, Lisp, simpsamp/out-hash-table.lisp: The simpsamp/out-hash-table<dot>lisp file
File, Lisp, simpsamp/out-list.lisp: The simpsamp/out-list<dot>lisp file
File, Lisp, simpsamp/out-map.lisp: The simpsamp/out-map<dot>lisp file
File, Lisp, simpsamp/out-vector.lisp: The simpsamp/out-vector<dot>lisp file
File, Lisp, simpsamp/output.lisp: The simpsamp/output<dot>lisp file
File, Lisp, simpsamp/package.lisp: The simpsamp/package<dot>lisp file
File, Lisp, simpsamp/test-core.lisp: The simpsamp/test-core<dot>lisp file
File, Lisp, simpsamp/test-outputs.lisp: The simpsamp/test-outputs<dot>lisp file
File, Lisp, simpsamp/test.lisp: The simpsamp/test<dot>lisp file
File, Lisp, simpsamp/unbounded-iterator.lisp: The simpsamp/unbounded-iterator<dot>lisp file

L
Lisp File, simpsamp.asd: The simpsamp<dot>asd file
Lisp File, simpsamp/core.lisp: The simpsamp/core<dot>lisp file
Lisp File, simpsamp/generic-functions.lisp: The simpsamp/generic-functions<dot>lisp file
Lisp File, simpsamp/input.lisp: The simpsamp/input<dot>lisp file
Lisp File, simpsamp/out-do.lisp: The simpsamp/out-do<dot>lisp file
Lisp File, simpsamp/out-hash-table.lisp: The simpsamp/out-hash-table<dot>lisp file
Lisp File, simpsamp/out-list.lisp: The simpsamp/out-list<dot>lisp file
Lisp File, simpsamp/out-map.lisp: The simpsamp/out-map<dot>lisp file
Lisp File, simpsamp/out-vector.lisp: The simpsamp/out-vector<dot>lisp file
Lisp File, simpsamp/output.lisp: The simpsamp/output<dot>lisp file
Lisp File, simpsamp/package.lisp: The simpsamp/package<dot>lisp file
Lisp File, simpsamp/test-core.lisp: The simpsamp/test-core<dot>lisp file
Lisp File, simpsamp/test-outputs.lisp: The simpsamp/test-outputs<dot>lisp file
Lisp File, simpsamp/test.lisp: The simpsamp/test<dot>lisp file
Lisp File, simpsamp/unbounded-iterator.lisp: The simpsamp/unbounded-iterator<dot>lisp file

S
simpsamp.asd: The simpsamp<dot>asd file
simpsamp/core.lisp: The simpsamp/core<dot>lisp file
simpsamp/generic-functions.lisp: The simpsamp/generic-functions<dot>lisp file
simpsamp/input.lisp: The simpsamp/input<dot>lisp file
simpsamp/out-do.lisp: The simpsamp/out-do<dot>lisp file
simpsamp/out-hash-table.lisp: The simpsamp/out-hash-table<dot>lisp file
simpsamp/out-list.lisp: The simpsamp/out-list<dot>lisp file
simpsamp/out-map.lisp: The simpsamp/out-map<dot>lisp file
simpsamp/out-vector.lisp: The simpsamp/out-vector<dot>lisp file
simpsamp/output.lisp: The simpsamp/output<dot>lisp file
simpsamp/package.lisp: The simpsamp/package<dot>lisp file
simpsamp/test-core.lisp: The simpsamp/test-core<dot>lisp file
simpsamp/test-outputs.lisp: The simpsamp/test-outputs<dot>lisp file
simpsamp/test.lisp: The simpsamp/test<dot>lisp file
simpsamp/unbounded-iterator.lisp: The simpsamp/unbounded-iterator<dot>lisp file

Jump to:   F   L   S  

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

A.2 Functions

Jump to:   D   F   G   H   L   M   R   S   T   V   W  
Index Entry  Section

D
define-typical-sample-methods: Internal macros
do-sample-of-hash-table: Exported macros
do-sample-of-iterator: Exported macros
do-sample-of-iterator-expr: Exported macros
do-sample-of-list: Exported macros
do-sample-of-range: Exported macros
do-sample-of-unbounded-iterator: Exported macros
do-sample-of-vector: Exported macros

F
Function, hash-table-sample-of-hash-table: Exported functions
Function, list->hash-table: Internal functions
Function, list->iterator-mv: Internal functions
Function, list->unbounded-iterator: Internal functions
Function, list-sample-of-hash-table-keys: Exported functions
Function, list-sample-of-hash-table-pairs: Exported functions
Function, list-sample-of-hash-table-values: Exported functions
Function, list-sample-of-iterator: Exported functions
Function, list-sample-of-list: Exported functions
Function, list-sample-of-range: Exported functions
Function, list-sample-of-unbounded-iterator: Exported functions
Function, list-sample-of-vector: Exported functions
Function, make-test-set-as-list: Internal functions
Function, make-test-set-as-range: Internal functions
Function, make-test-set-as-vector: Internal functions
Function, map-sample-of-hash-table: Exported functions
Function, map-sample-of-hash-table-keys: Exported functions
Function, map-sample-of-hash-table-values: Exported functions
Function, map-sample-of-iterator: Exported functions
Function, map-sample-of-list: Exported functions
Function, map-sample-of-range: Exported functions
Function, map-sample-of-unbounded-iterator: Exported functions
Function, map-sample-of-vector: Exported functions
Function, measure-selection-rates: Internal functions
Function, report-selection-rates: Internal functions
Function, test: Exported functions
Function, test-computed-sample: Internal functions
Function, test-core: Internal functions
Function, test-output: Internal functions
Function, test-output-as-hash-table: Internal functions
Function, test-output-as-iteration: Internal functions
Function, test-output-as-list: Internal functions
Function, test-output-as-mapping: Internal functions
Function, test-output-as-vector: Internal functions
Function, test-output-methods: Internal functions
Function, vector-sample-of-hash-table-keys: Exported functions
Function, vector-sample-of-hash-table-pairs: Exported functions
Function, vector-sample-of-hash-table-values: Exported functions
Function, vector-sample-of-iterator: Exported functions
Function, vector-sample-of-list: Exported functions
Function, vector-sample-of-range: Exported functions
Function, vector-sample-of-unbounded-iterator: Exported functions
Function, vector-sample-of-vector: Exported functions

G
Generic Function, list-sample: Exported generic functions
Generic Function, map-sample: Exported generic functions
Generic Function, sample: Exported generic functions
Generic Function, vector-sample: Exported generic functions

H
hash-table-sample-of-hash-table: Exported functions

L
list->hash-table: Internal functions
list->iterator-mv: Internal functions
list->unbounded-iterator: Internal functions
list-sample: Exported generic functions
list-sample: Exported generic functions
list-sample: Exported generic functions
list-sample: Exported generic functions
list-sample-of-hash-table-keys: Exported functions
list-sample-of-hash-table-pairs: Exported functions
list-sample-of-hash-table-values: Exported functions
list-sample-of-iterator: Exported functions
list-sample-of-list: Exported functions
list-sample-of-range: Exported functions
list-sample-of-unbounded-iterator: Exported functions
list-sample-of-vector: Exported functions

M
Macro, define-typical-sample-methods: Internal macros
Macro, do-sample-of-hash-table: Exported macros
Macro, do-sample-of-iterator: Exported macros
Macro, do-sample-of-iterator-expr: Exported macros
Macro, do-sample-of-list: Exported macros
Macro, do-sample-of-range: Exported macros
Macro, do-sample-of-unbounded-iterator: Exported macros
Macro, do-sample-of-vector: Exported macros
Macro, test-accumulated-sample: Internal macros
Macro, test-do-sample: Internal macros
Macro, test-list-sample: Internal macros
Macro, test-vector-sample: Internal macros
Macro, vector-sample-of-unbounded-iterator-expr: Exported macros
Macro, with-hash-table-accumulator: Internal macros
Macro, with-list-accumulator: Internal macros
Macro, with-list-iterator: Internal macros
Macro, with-range-iterator: Internal macros
Macro, with-vector-accumulator: Internal macros
Macro, with-vector-iterator: Internal macros
make-test-set-as-list: Internal functions
make-test-set-as-range: Internal functions
make-test-set-as-vector: Internal functions
map-sample: Exported generic functions
map-sample: Exported generic functions
map-sample: Exported generic functions
map-sample: Exported generic functions
map-sample-of-hash-table: Exported functions
map-sample-of-hash-table-keys: Exported functions
map-sample-of-hash-table-values: Exported functions
map-sample-of-iterator: Exported functions
map-sample-of-list: Exported functions
map-sample-of-range: Exported functions
map-sample-of-unbounded-iterator: Exported functions
map-sample-of-vector: Exported functions
measure-selection-rates: Internal functions
Method, list-sample: Exported generic functions
Method, list-sample: Exported generic functions
Method, list-sample: Exported generic functions
Method, map-sample: Exported generic functions
Method, map-sample: Exported generic functions
Method, map-sample: Exported generic functions
Method, sample: Exported generic functions
Method, sample: Exported generic functions
Method, sample: Exported generic functions
Method, vector-sample: Exported generic functions
Method, vector-sample: Exported generic functions
Method, vector-sample: Exported generic functions

R
report-selection-rates: Internal functions

S
sample: Exported generic functions
sample: Exported generic functions
sample: Exported generic functions
sample: Exported generic functions

T
test: Exported functions
test-accumulated-sample: Internal macros
test-computed-sample: Internal functions
test-core: Internal functions
test-do-sample: Internal macros
test-list-sample: Internal macros
test-output: Internal functions
test-output-as-hash-table: Internal functions
test-output-as-iteration: Internal functions
test-output-as-list: Internal functions
test-output-as-mapping: Internal functions
test-output-as-vector: Internal functions
test-output-methods: Internal functions
test-vector-sample: Internal macros

V
vector-sample: Exported generic functions
vector-sample: Exported generic functions
vector-sample: Exported generic functions
vector-sample: Exported generic functions
vector-sample-of-hash-table-keys: Exported functions
vector-sample-of-hash-table-pairs: Exported functions
vector-sample-of-hash-table-values: Exported functions
vector-sample-of-iterator: Exported functions
vector-sample-of-list: Exported functions
vector-sample-of-range: Exported functions
vector-sample-of-unbounded-iterator: Exported functions
vector-sample-of-unbounded-iterator-expr: Exported macros
vector-sample-of-vector: Exported functions

W
with-hash-table-accumulator: Internal macros
with-list-accumulator: Internal macros
with-list-iterator: Internal macros
with-range-iterator: Internal macros
with-vector-accumulator: Internal macros
with-vector-iterator: Internal macros

Jump to:   D   F   G   H   L   M   R   S   T   V   W  

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

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*test-output-lower-bound*: Internal special variables
*test-output-upper-bound*: Internal special variables

S
Special Variable, *test-output-lower-bound*: Internal special variables
Special Variable, *test-output-upper-bound*: Internal special variables

Jump to:   *  
S  

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

A.4 Data types

Jump to:   P   S  
Index Entry  Section

P
Package, simpsamp: The simpsamp package

S
simpsamp: The simpsamp system
simpsamp: The simpsamp package
System, simpsamp: The simpsamp system

Jump to:   P   S