The data-table Reference Manual

Table of Contents

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

The data-table Reference Manual

This is the data-table Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 08:32:53 2018 GMT+0.


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

1 Introduction

Data Table

A Common Lisp library providing a data-table data-structure that has rows of data and column names and types

Goals

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 data-table

License

BSD

Description

A library providing a data-table class, and useful functionality around this

Version

0.1

Dependencies
Source

data-table.asd (file)

Component

data-table.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 data-table.asd

Location

data-table.asd

Systems

data-table (system)

Packages

data-table.system


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

3.1.2 data-table/data-table.lisp

Parent

data-table (system)

Location

data-table.lisp

Packages

data-table

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 data-table.system

Source

data-table.asd

Use List

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

4.2 data-table

Source

data-table.lisp (file)

Use List
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 Special variables

Special Variable: *guessing-types-sample-size*

how many rows to look at when trying to guess the types for each column of a data table

Package

data-table

Source

data-table.lisp (file)


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

5.1.2 Functions

Function: add-column DT COLUMN-NAME &optional DEFAULT COLUMN-TYPE INDEX

Adds a new column to the data table passed in

Package

data-table

Source

data-table.lisp (file)

Function: alists-to-data-table LIST-OF-ALISTS &key TEST KEYS

given a list of alists, (all with the same keys) convert them to a data-table

Package

data-table

Source

data-table.lisp (file)

Function: coerce-data-table-of-strings-to-types DT

Figure out what the data-table-types should be then convert all the data in the table to those types

Package

data-table

Source

data-table.lisp (file)

Function: coerce-data-table-values-for-output DT &key OUTPUT-TYPE

Coerce for output all the values in all the rows and return the new rows

Package

data-table

Source

data-table.lisp (file)

Function: coerce-data-table-values-for-output! DT &key OUTPUT-TYPE

Coerce for output all the values in all the rows and save the result to the rows slot

Package

data-table

Source

data-table.lisp (file)

Function: column-index COL DT
Package

data-table

Source

data-table.lisp (file)

Function: column-name COL DT
Function: (setf column-name) NEW COL DT
Package

data-table

Source

data-table.lisp (file)

Function: column-type COL DT
Function: (setf column-type) NEW COL DT
Package

data-table

Source

data-table.lisp (file)

Function: data-table-to-alists DT
Package

data-table

Source

data-table.lisp (file)

Function: data-table-to-plists DT
Package

data-table

Source

data-table.lisp (file)

Function: plists-to-data-table LIST-OF-PLISTS &key KEYS
Package

data-table

Source

data-table.lisp (file)

Function: select-columns TABLE COLUMN-NAMES

returns a new data table with only the columns requested, by name

Package

data-table

Source

data-table.lisp (file)


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

5.1.3 Generic functions

Generic Function: coerce-value-for-output DT COLUMN-NAME VAL OUTPUT-TYPE
Package

data-table

Methods
Method: coerce-value-for-output (DT data-table) COLUMN-NAME VAL OUTPUT-TYPE &aux *LIST-DELIMITER*

Coerce a data-tables-value to a specified output format.
By default only strings are supported. This method is intended to be extended in other applications to allow mutating to html / csv / etc

Source

data-table.lisp (file)

Generic Function: column-names OBJECT
Generic Function: (setf column-names) NEW-VALUE OBJECT
Package

data-table

Methods
Method: column-names (DATA-TABLE data-table)

automatically generated reader method

Source

data-table.lisp (file)

Method: (setf column-names) NEW-VALUE (DATA-TABLE data-table)

automatically generated writer method

Source

data-table.lisp (file)

Generic Function: column-types OBJECT
Generic Function: (setf column-types) NEW-VALUE OBJECT
Package

data-table

Methods
Method: column-types (DATA-TABLE data-table)

automatically generated reader method

Source

data-table.lisp (file)

Method: (setf column-types) NEW-VALUE (DATA-TABLE data-table)

automatically generated writer method

Source

data-table.lisp (file)

Generic Function: data-table-data-compare DT1 DT2 &key TEST KEY
Package

data-table

Methods
Method: data-table-data-compare DT1 DT2 &key TEST KEY

tries to comapre the data in two data-tables

Source

data-table.lisp (file)

Generic Function: data-table-value DT &key COL-NAME COL-IDX ROW-IDX ROW
Generic Function: (setf data-table-value) NEW DT &key COL-NAME ROW-IDX COL-IDX
Package

data-table

Methods
Method: data-table-value (DT data-table) &key COL-NAME COL-IDX ROW-IDX ROW

Extract a value or set of values from the data table
can be used to pull a column of data, a row of data or a specific cell of data

Source

data-table.lisp (file)

Method: (setf data-table-value) NEW (DT data-table) &key COL-NAME ROW-IDX COL-IDX

Set a specific row, column or cell of the data table

Source

data-table.lisp (file)

Generic Function: fill-in-missing-cells DT &optional MISSING-VALUE
Package

data-table

Methods
Method: fill-in-missing-cells (DT data-table) &optional MISSING-VALUE

Ensures that the data table is square and that every column has the same number of rows and every row has the same number of columns, filling in nil to accomplish this

Source

data-table.lisp (file)

Generic Function: make-sub-table PARENT &key LCI UCI LRI URI
Package

data-table

Methods
Method: make-sub-table PARENT &key LCI UCI LRI URI

Make a new data table from a subset of another data-table
lci - low column index
uci - upper column index (as per subseq 1 beyond the col you want) lri - low row index
uri - upper row index (as per subseq 1 beyond the row you want)

Source

data-table.lisp (file)

Generic Function: number-of-columns DT
Package

data-table

Methods
Method: number-of-columns (DT data-table)
Source

data-table.lisp (file)

Generic Function: number-of-rows DT
Package

data-table

Methods
Method: number-of-rows (DT data-table)
Source

data-table.lisp (file)

Generic Function: overlay-region NEW DT &key ROW-IDX COL-IDX
Package

data-table

Methods
Method: overlay-region (NEW data-table) (DT data-table) &key ROW-IDX COL-IDX

puts all values from new-dt into dt starting at row-idx col-idx

Source

data-table.lisp (file)

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

data-table

Methods
Method: rows (DATA-TABLE data-table)

automatically generated reader method

Source

data-table.lisp (file)

Method: (setf rows) NEW-VALUE (DATA-TABLE data-table)

automatically generated writer method

Source

data-table.lisp (file)

Generic Function: symbolize-column-names DT
Package

data-table

Methods
Method: symbolize-column-names (DT data-table)

Turn the column names of the data table into lisp symbols

Source

data-table.lisp (file)

Generic Function: symbolize-column-names! DT
Package

data-table

Methods
Method: symbolize-column-names! (DT data-table)

Turn the column names of the data table into lisp symbols save the new column names to the data table

Source

data-table.lisp (file)


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

5.1.4 Conditions

Condition: bad-type-guess ()
Package

data-table

Source

data-table.lisp (file)

Direct superclasses

error (condition)

Direct methods
Direct slots
Slot: expected-type
Initargs

:expected-type

Readers

expected-type (generic function)

Slot: original-error
Initargs

:original-error

Readers

original-error (generic function)

Slot: value
Initargs

:value

Readers

value (generic function)


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

5.1.5 Classes

Class: data-table ()

A class representing a table of data

Package

data-table

Source

data-table.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: column-names
Initargs

:column-names

Readers

column-names (generic function)

Writers

(setf column-names) (generic function)

Slot: column-types
Initargs

:column-types

Readers

column-types (generic function)

Writers

(setf column-types) (generic function)

Slot: rows
Initargs

:rows

Readers

rows (generic function)

Writers

(setf rows) (generic function)


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

5.2 Internal definitions


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

5.2.1 Special variables

Special Variable: *list-delimiter*

What we will splice lists together with in coerce-value-for-output

Package

data-table

Source

data-table.lisp (file)

Special Variable: +common-white-space-trimbag+
Package

data-table

Source

data-table.lisp (file)

Special Variable: +largest-number+

this is the largest number that will be considered a number for data-type purposes.

Package

data-table

Source

data-table.lisp (file)


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

5.2.2 Functions

Function: %add-column-heading/type DT NAME TYPE INDEX

this function tries to handle their not being any current column types or names or incomplete specification but will leave us with the same (+ 1 number-of-columns) as we started with

Package

data-table

Source

data-table.lisp (file)

Function: %insert-value-in-list ROW INDEX VALUE

build a new data row by splicing a value into the existing row

Package

data-table

Source

data-table.lisp (file)

Function: alist-keys AL
Package

data-table

Source

data-table.lisp (file)

Function: alist-values AL &optional KEYS TEST
Package

data-table

Source

data-table.lisp (file)

Function: ensure-column-data-types DT

Given missing data types or data-types only of strings, figure out
what the data-types for the table should be set the slot on the data-table

Package

data-table

Source

data-table.lisp (file)

Function: guess-types-for-data-table DATA-TABLE
Package

data-table

Source

data-table.lisp (file)

Function: maybe-apply FN &rest ARGS

Call a function, when it exists
used to avoid calling clsql code if it does not exits

Package

data-table

Source

data-table.lisp (file)

Function: plist-keys PL
Package

data-table

Source

data-table.lisp (file)

Function: plist-values PL &optional KEYS
Package

data-table

Source

data-table.lisp (file)

Function: sample-rows ROWS &key SAMPLE-SIZE

get a subset of the rows using reservior sampling

Package

data-table

Source

data-table.lisp (file)

Function: simplify-types VAL &aux COMPLEX-TYPE

try to get simple type definitions from complex ones

Package

data-table

Source

data-table.lisp (file)

Function: transpose-lists LIST-OF-LISTS

Transpose a matrix represented as a list of lists.
Example: (transpose ’((a b c) (d e f))) => ((a d) (b e) (c f)).

Package

data-table

Source

data-table.lisp (file)

Function: trim-and-nullify S

trims the whitespace from a string returning nil
if trimming produces an empty string or the string ’nil’

Package

data-table

Source

data-table.lisp (file)

Function: trim-whitespace S
Package

data-table

Source

data-table.lisp (file)


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

5.2.3 Generic functions

Generic Function: data-table-coerce D TYPE
Package

data-table

Methods
Method: data-table-coerce D TYPE
Source

data-table.lisp (file)

Generic Function: expected-type CONDITION
Package

data-table

Methods
Method: expected-type (CONDITION bad-type-guess)
Source

data-table.lisp (file)

Generic Function: original-error CONDITION
Package

data-table

Methods
Method: original-error (CONDITION bad-type-guess)
Source

data-table.lisp (file)

Generic Function: relaxed-parse-float STR &key TYPE
Package

data-table

Methods
Method: relaxed-parse-float STR &key TYPE

trys to read a value we hope to be a floating point number returns nil on failure

The goal is to allow reading strings with spaces commas and dollar signs in them correctly

Source

data-table.lisp (file)

Generic Function: value CONDITION
Package

data-table

Methods
Method: value (CONDITION bad-type-guess)
Source

data-table.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   D   F   L  
Index Entry  Section

D
data-table.asd: The data-table<dot>asd file
data-table/data-table.lisp: The data-table/data-table<dot>lisp file

F
File, Lisp, data-table.asd: The data-table<dot>asd file
File, Lisp, data-table/data-table.lisp: The data-table/data-table<dot>lisp file

L
Lisp File, data-table.asd: The data-table<dot>asd file
Lisp File, data-table/data-table.lisp: The data-table/data-table<dot>lisp file

Jump to:   D   F   L  

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

A.2 Functions

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

%
%add-column-heading/type: Internal functions
%insert-value-in-list: Internal functions

(
(setf column-name): Exported functions
(setf column-names): Exported generic functions
(setf column-names): Exported generic functions
(setf column-type): Exported functions
(setf column-types): Exported generic functions
(setf column-types): Exported generic functions
(setf data-table-value): Exported generic functions
(setf data-table-value): Exported generic functions
(setf rows): Exported generic functions
(setf rows): Exported generic functions

A
add-column: Exported functions
alist-keys: Internal functions
alist-values: Internal functions
alists-to-data-table: Exported functions

C
coerce-data-table-of-strings-to-types: Exported functions
coerce-data-table-values-for-output: Exported functions
coerce-data-table-values-for-output!: Exported functions
coerce-value-for-output: Exported generic functions
coerce-value-for-output: Exported generic functions
column-index: Exported functions
column-name: Exported functions
column-names: Exported generic functions
column-names: Exported generic functions
column-type: Exported functions
column-types: Exported generic functions
column-types: Exported generic functions

D
data-table-coerce: Internal generic functions
data-table-coerce: Internal generic functions
data-table-data-compare: Exported generic functions
data-table-data-compare: Exported generic functions
data-table-to-alists: Exported functions
data-table-to-plists: Exported functions
data-table-value: Exported generic functions
data-table-value: Exported generic functions

E
ensure-column-data-types: Internal functions
expected-type: Internal generic functions
expected-type: Internal generic functions

F
fill-in-missing-cells: Exported generic functions
fill-in-missing-cells: Exported generic functions
Function, %add-column-heading/type: Internal functions
Function, %insert-value-in-list: Internal functions
Function, (setf column-name): Exported functions
Function, (setf column-type): Exported functions
Function, add-column: Exported functions
Function, alist-keys: Internal functions
Function, alist-values: Internal functions
Function, alists-to-data-table: Exported functions
Function, coerce-data-table-of-strings-to-types: Exported functions
Function, coerce-data-table-values-for-output: Exported functions
Function, coerce-data-table-values-for-output!: Exported functions
Function, column-index: Exported functions
Function, column-name: Exported functions
Function, column-type: Exported functions
Function, data-table-to-alists: Exported functions
Function, data-table-to-plists: Exported functions
Function, ensure-column-data-types: Internal functions
Function, guess-types-for-data-table: Internal functions
Function, maybe-apply: Internal functions
Function, plist-keys: Internal functions
Function, plist-values: Internal functions
Function, plists-to-data-table: Exported functions
Function, sample-rows: Internal functions
Function, select-columns: Exported functions
Function, simplify-types: Internal functions
Function, transpose-lists: Internal functions
Function, trim-and-nullify: Internal functions
Function, trim-whitespace: Internal functions

G
Generic Function, (setf column-names): Exported generic functions
Generic Function, (setf column-types): Exported generic functions
Generic Function, (setf data-table-value): Exported generic functions
Generic Function, (setf rows): Exported generic functions
Generic Function, coerce-value-for-output: Exported generic functions
Generic Function, column-names: Exported generic functions
Generic Function, column-types: Exported generic functions
Generic Function, data-table-coerce: Internal generic functions
Generic Function, data-table-data-compare: Exported generic functions
Generic Function, data-table-value: Exported generic functions
Generic Function, expected-type: Internal generic functions
Generic Function, fill-in-missing-cells: Exported generic functions
Generic Function, make-sub-table: Exported generic functions
Generic Function, number-of-columns: Exported generic functions
Generic Function, number-of-rows: Exported generic functions
Generic Function, original-error: Internal generic functions
Generic Function, overlay-region: Exported generic functions
Generic Function, relaxed-parse-float: Internal generic functions
Generic Function, rows: Exported generic functions
Generic Function, symbolize-column-names: Exported generic functions
Generic Function, symbolize-column-names!: Exported generic functions
Generic Function, value: Internal generic functions
guess-types-for-data-table: Internal functions

M
make-sub-table: Exported generic functions
make-sub-table: Exported generic functions
maybe-apply: Internal functions
Method, (setf column-names): Exported generic functions
Method, (setf column-types): Exported generic functions
Method, (setf data-table-value): Exported generic functions
Method, (setf rows): Exported generic functions
Method, coerce-value-for-output: Exported generic functions
Method, column-names: Exported generic functions
Method, column-types: Exported generic functions
Method, data-table-coerce: Internal generic functions
Method, data-table-data-compare: Exported generic functions
Method, data-table-value: Exported generic functions
Method, expected-type: Internal generic functions
Method, fill-in-missing-cells: Exported generic functions
Method, make-sub-table: Exported generic functions
Method, number-of-columns: Exported generic functions
Method, number-of-rows: Exported generic functions
Method, original-error: Internal generic functions
Method, overlay-region: Exported generic functions
Method, relaxed-parse-float: Internal generic functions
Method, rows: Exported generic functions
Method, symbolize-column-names: Exported generic functions
Method, symbolize-column-names!: Exported generic functions
Method, value: Internal generic functions

N
number-of-columns: Exported generic functions
number-of-columns: Exported generic functions
number-of-rows: Exported generic functions
number-of-rows: Exported generic functions

O
original-error: Internal generic functions
original-error: Internal generic functions
overlay-region: Exported generic functions
overlay-region: Exported generic functions

P
plist-keys: Internal functions
plist-values: Internal functions
plists-to-data-table: Exported functions

R
relaxed-parse-float: Internal generic functions
relaxed-parse-float: Internal generic functions
rows: Exported generic functions
rows: Exported generic functions

S
sample-rows: Internal functions
select-columns: Exported functions
simplify-types: Internal functions
symbolize-column-names: Exported generic functions
symbolize-column-names: Exported generic functions
symbolize-column-names!: Exported generic functions
symbolize-column-names!: Exported generic functions

T
transpose-lists: Internal functions
trim-and-nullify: Internal functions
trim-whitespace: Internal functions

V
value: Internal generic functions
value: Internal generic functions

Jump to:   %   (  
A   C   D   E   F   G   M   N   O   P   R   S   T   V  

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

A.3 Variables

Jump to:   *   +  
C   E   O   R   S   V  
Index Entry  Section

*
*guessing-types-sample-size*: Exported special variables
*list-delimiter*: Internal special variables

+
+common-white-space-trimbag+: Internal special variables
+largest-number+: Internal special variables

C
column-names: Exported classes
column-types: Exported classes

E
expected-type: Exported conditions

O
original-error: Exported conditions

R
rows: Exported classes

S
Slot, column-names: Exported classes
Slot, column-types: Exported classes
Slot, expected-type: Exported conditions
Slot, original-error: Exported conditions
Slot, rows: Exported classes
Slot, value: Exported conditions
Special Variable, *guessing-types-sample-size*: Exported special variables
Special Variable, *list-delimiter*: Internal special variables
Special Variable, +common-white-space-trimbag+: Internal special variables
Special Variable, +largest-number+: Internal special variables

V
value: Exported conditions

Jump to:   *   +  
C   E   O   R   S   V  

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

A.4 Data types

Jump to:   B   C   D   P   S  
Index Entry  Section

B
bad-type-guess: Exported conditions

C
Class, data-table: Exported classes
Condition, bad-type-guess: Exported conditions

D
data-table: The data-table system
data-table: The data-table package
data-table: Exported classes
data-table.system: The data-table<dot>system package

P
Package, data-table: The data-table package
Package, data-table.system: The data-table<dot>system package

S
System, data-table: The data-table system

Jump to:   B   C   D   P   S