The validate-list Reference Manual

This is the validate-list Reference Manual, version 1.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 18:12:37 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 validate-list

Allows you to validate the contents and structure of a list based off of a template

Author

K1D77A

License

MIT

Version

1.0.1

Dependencies
  • arithmetic-operators-as-words (system).
  • lisp-unit (system).
  • alexandria (system).
Source

validate-list.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 validate-list/src

Source

validate-list.asd.

Parent Component

validate-list (system).

Child Components

4 Files

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


4.1 Lisp


4.1.1 validate-list/validate-list.asd

Source

validate-list.asd.

Parent Component

validate-list (system).

ASDF Systems

validate-list.


4.1.2 validate-list/src/package.lisp

Source

validate-list.asd.

Parent Component

src (module).

Packages

validate-list.


4.1.3 validate-list/src/conditions.lisp

Dependency

package.lisp (file).

Source

validate-list.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.4 validate-list/src/validate-list.lisp

Dependency

conditions.lisp (file).

Source

validate-list.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.5 validate-list/src/compile-template.lisp

Dependency

validate-list.lisp (file).

Source

validate-list.asd.

Parent Component

src (module).

Public Interface

compile-template (function).

Internals

5 Packages

Packages are listed by definition order.


5.1 validate-list

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

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


6.1 Public Interface


6.1.1 Compiler macros

Compiler Macro: validate-list (list template)
Package

validate-list.

Source

validate-list.lisp.


6.1.2 Ordinary functions

Function: compile-template (template &optional see-code)

Takes in a valid TEMPLATE and returns a compiled 1 argument function. This function is called
with a list, ie the one you wish to validate. This function will signal a BAD-TEMPLATE-FORMAT condition if the template is bad.

Package

validate-list.

Source

compile-template.lisp.

Function: current-keys ()
Package

validate-list.

Source

validate-list.lisp.

Function: define-key (key func)

Takes in a keyword and associates the keyword with the function. The function must accept two
arguments, the first an entry ie a value in a list wanting to be validated and the second an object
see any of the other uses of DEFINE-KEY in src/validate-list.lisp to get an idea what your lambda should look like. Here is an example (define-key :n=
(lambda (entry arg)
(check-type entry number)
(check-type arg number)
(= entry arg)))
Now with the new keyword :n= defined this can be used in a template like so where list is ’(100)
and the template is ’((:n= 100)).

Package

validate-list.

Source

validate-list.lisp.

Function: is-valid-template (template)

Takes in a TEMPLATE and attempts to make sure it has a valid structure. If it does not then signals condition BAD-TEMPLATE-FORMAT

Package

validate-list.

Source

validate-list.lisp.

Function: repeat-pattern (length pattern-list)

Given a length and a list this will return a list of LENGTH with PATTERN-LIST repeated LENGTH times

Package

validate-list.

Source

validate-list.lisp.

Function: repeat-test (length validation-list)

Returns a list of length LENGTH which simply repeats VALIDATION-LIST

Package

validate-list.

Source

validate-list.lisp.

Function: same-structures-p (list template &optional print-lists)

Given LIST and TEMPLATE of arbitrary depth, return t if they have the same structure or nil if not. In the event of any error this function returns nil, as the assumption is that the structures are not the same.

Package

validate-list.

Source

validate-list.lisp.

Function: validate-list (list template)

Takes in a LIST that you want to validate, and a TEMPLATE, the TEMPLATE is a list of lists,
each list contains keywords and their values (a full list of keys can be found by calling CURRENT-KEYS), if TEMPLATE is ’invalid’ then the condition BAD-TEMPLATE-FORM is signalled. Each list within the template represents 1 element in the LIST and is a ’description’ of its contents.
For example given the template ’((:equal "key") (:type string :maxlen 40)) this could be used
to validate the list ’("key" "abcdeegadfgfsdf") because as the template says, the first item in
list is "key" and the second according to the template should be of type ’string and no longer
than 40 characters long, which it is not, so this is valid and will return t, if a list fails when
checked against the template then this func signals the condition FAILED-TO-VALIDATE, which
will contain information about where validation failed. For a list of examples see src/tests.lisp, the invalid templates are marked.
In the interests of speed no checks are done to validate the structure of your template
before validation happens,
you can use ’is-valid-template’ as a precursory check to make sure that the template is
constructed with valid plists and valid keywords. There is also the possibility that when you try
to validate a list where you expect a certain structure and get something else you will get a
BAD-TEMPLATE-FORM condition where the template is fine but the list is not, just treat this like
the validation failed.

Package

validate-list.

Source

validate-list.lisp.


6.1.3 Generic functions

Generic Reader: bad-template-format-message (condition)
Generic Writer: (setf bad-template-format-message) (condition)
Package

validate-list.

Methods
Reader Method: bad-template-format-message ((condition bad-template-format))
Writer Method: (setf bad-template-format-message) ((condition bad-template-format))
Source

conditions.lisp.

Target Slot

message.

Generic Reader: bad-template-format-signaller (condition)
Generic Writer: (setf bad-template-format-signaller) (condition)
Package

validate-list.

Methods
Reader Method: bad-template-format-signaller ((condition bad-template-format))
Writer Method: (setf bad-template-format-signaller) ((condition bad-template-format))
Source

conditions.lisp.

Target Slot

signaller.

Generic Reader: bad-template-format-template (condition)
Generic Writer: (setf bad-template-format-template) (condition)
Package

validate-list.

Methods
Reader Method: bad-template-format-template ((condition bad-template-format))
Writer Method: (setf bad-template-format-template) ((condition bad-template-format))
Source

conditions.lisp.

Target Slot

template.

Generic Reader: failed-to-validate-arg (condition)
Generic Writer: (setf failed-to-validate-arg) (condition)
Package

validate-list.

Methods
Reader Method: failed-to-validate-arg ((condition failed-to-validate))
Writer Method: (setf failed-to-validate-arg) ((condition failed-to-validate))
Source

conditions.lisp.

Target Slot

failed-to-validate-arg.

Generic Reader: failed-to-validate-entry (condition)
Generic Writer: (setf failed-to-validate-entry) (condition)
Package

validate-list.

Methods
Reader Method: failed-to-validate-entry ((condition failed-to-validate))
Writer Method: (setf failed-to-validate-entry) ((condition failed-to-validate))
Source

conditions.lisp.

Target Slot

failed-to-validate-entry.

Generic Reader: failed-to-validate-key (condition)
Generic Writer: (setf failed-to-validate-key) (condition)
Package

validate-list.

Methods
Reader Method: failed-to-validate-key ((condition failed-to-validate))
Writer Method: (setf failed-to-validate-key) ((condition failed-to-validate))
Source

conditions.lisp.

Target Slot

failed-to-validate-key.

Generic Reader: failed-to-validate-message (condition)
Generic Writer: (setf failed-to-validate-message) (condition)
Package

validate-list.

Methods
Reader Method: failed-to-validate-message ((condition failed-to-validate))
Writer Method: (setf failed-to-validate-message) ((condition failed-to-validate))
Source

conditions.lisp.

Target Slot

failed-to-validate-message.

Generic Reader: unknown-keyword-keyword (condition)
Generic Writer: (setf unknown-keyword-keyword) (condition)
Package

validate-list.

Methods
Reader Method: unknown-keyword-keyword ((condition unknown-keyword))
Writer Method: (setf unknown-keyword-keyword) ((condition unknown-keyword))
Source

conditions.lisp.

Target Slot

keyword.

Generic Reader: unknown-keyword-message (condition)
Generic Writer: (setf unknown-keyword-message) (condition)
Package

validate-list.

Methods
Reader Method: unknown-keyword-message ((condition unknown-keyword))
Writer Method: (setf unknown-keyword-message) ((condition unknown-keyword))
Source

conditions.lisp.

Target Slot

message.


6.1.4 Standalone methods

Method: print-object ((object bad-template-format) stream)
Source

conditions.lisp.

Method: print-object ((object failed-to-validate) stream)
Source

conditions.lisp.

Method: print-object ((object unknown-keyword) stream)
Source

conditions.lisp.


6.1.5 Conditions

Condition: bad-template-format
Package

validate-list.

Source

conditions.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: template
Initargs

:bad-template-format-template

Readers

bad-template-format-template.

Writers

(setf bad-template-format-template).

Slot: signaller

Contains the condition which was called that caused this condition to be signalled

Initargs

:bad-template-format-signaller

Readers

bad-template-format-signaller.

Writers

(setf bad-template-format-signaller).

Slot: message

Message indicating what when wrong

Initargs

:bad-template-format-message

Readers

bad-template-format-message.

Writers

(setf bad-template-format-message).

Condition: failed-to-validate
Package

validate-list.

Source

conditions.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: failed-to-validate-key
Initargs

:failed-to-validate-key

Readers

failed-to-validate-key.

Writers

(setf failed-to-validate-key).

Slot: failed-to-validate-arg
Initargs

:failed-to-validate-arg

Readers

failed-to-validate-arg.

Writers

(setf failed-to-validate-arg).

Slot: failed-to-validate-entry
Initargs

:failed-to-validate-entry

Readers

failed-to-validate-entry.

Writers

(setf failed-to-validate-entry).

Slot: failed-to-validate-message

Message indicating what when wrong

Initargs

:failed-to-validate-message

Readers

failed-to-validate-message.

Writers

(setf failed-to-validate-message).

Condition: unknown-keyword
Package

validate-list.

Source

conditions.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: keyword
Package

common-lisp.

Initargs

:unknown-keyword-keyword

Readers

unknown-keyword-keyword.

Writers

(setf unknown-keyword-keyword).

Slot: message

Message indicating what when wrong

Initargs

:unknown-keyword-message

Readers

unknown-keyword-message.

Writers

(setf unknown-keyword-message).


6.2 Internals


6.2.1 Special variables

Special Variable: *compiled-hash*
Package

validate-list.

Source

validate-list.lisp.

Special Variable: *functions*
Package

validate-list.

Source

validate-list.lisp.

Special Variable: *validate-list-p-err-message*
Package

validate-list.

Source

validate-list.lisp.


6.2.2 Ordinary functions

Function: argument (template-fun)
Package

validate-list.

Source

compile-template.lisp.

Function: call-fun-check-true (fun arg1 arg2)
Package

validate-list.

Source

compile-template.lisp.

Function: compile-template-entry (template-entry)
Package

validate-list.

Source

compile-template.lisp.

Function: fun (template-fun)
Package

validate-list.

Source

compile-template.lisp.

Function: handle-between (entry between-list)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-contents (entry template-entry)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-equal (entry equal)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-greater-than (entry greater-than)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-length (entry length)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-less-than (entry less-than)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-maxlen (entry maxlen)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-minlen (entry minlen)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-or (entry list-of-potentials)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-satisfies (entry func)
Package

validate-list.

Source

validate-list.lisp.

Function: handle-type (entry type)
Package

validate-list.

Source

validate-list.lisp.

Function: keyword->function (keyword)

Given a keyword in KEYWORD, this function looks for the associated function in *functions* if found then the function is returned, otherwise a UNKNOWN-KEYWORD condition is signalled.

Package

validate-list.

Source

validate-list.lisp.

Function: map-plist (func plist)

Maps a PLIST and calls FUNC that accepts two arguments. returns a list of funcall-result

Package

validate-list.

Source

validate-list.lisp.

Function: process-template-entry (template-entry entry)
Package

validate-list.

Source

validate-list.lisp.

Function: process-template-funs (template)

Takes in a TEMPLATE and converts all the key args within each plist into the associated functions ready to be called

Package

validate-list.

Source

compile-template.lisp.

Function: quoted-p (form)
Package

validate-list.

Source

validate-list.lisp.

Function: signal-bad-template-format (template message &optional signaller)
Package

validate-list.

Source

conditions.lisp.

Function: signal-failed-to-validate (keyword arg entry message)
Package

validate-list.

Source

conditions.lisp.

Function: signal-unknown-keyword (keyword message)
Package

validate-list.

Source

conditions.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   B   C   D   F   G   H   I   K   M   P   Q   R   S   U   V  
Index Entry  Section

(
(setf bad-template-format-message): Public generic functions
(setf bad-template-format-message): Public generic functions
(setf bad-template-format-signaller): Public generic functions
(setf bad-template-format-signaller): Public generic functions
(setf bad-template-format-template): Public generic functions
(setf bad-template-format-template): Public generic functions
(setf failed-to-validate-arg): Public generic functions
(setf failed-to-validate-arg): Public generic functions
(setf failed-to-validate-entry): Public generic functions
(setf failed-to-validate-entry): Public generic functions
(setf failed-to-validate-key): Public generic functions
(setf failed-to-validate-key): Public generic functions
(setf failed-to-validate-message): Public generic functions
(setf failed-to-validate-message): Public generic functions
(setf unknown-keyword-keyword): Public generic functions
(setf unknown-keyword-keyword): Public generic functions
(setf unknown-keyword-message): Public generic functions
(setf unknown-keyword-message): Public generic functions

A
argument: Private ordinary functions

B
bad-template-format-message: Public generic functions
bad-template-format-message: Public generic functions
bad-template-format-signaller: Public generic functions
bad-template-format-signaller: Public generic functions
bad-template-format-template: Public generic functions
bad-template-format-template: Public generic functions

C
call-fun-check-true: Private ordinary functions
compile-template: Public ordinary functions
compile-template-entry: Private ordinary functions
Compiler Macro, validate-list: Public compiler macros
current-keys: Public ordinary functions

D
define-key: Public ordinary functions

F
failed-to-validate-arg: Public generic functions
failed-to-validate-arg: Public generic functions
failed-to-validate-entry: Public generic functions
failed-to-validate-entry: Public generic functions
failed-to-validate-key: Public generic functions
failed-to-validate-key: Public generic functions
failed-to-validate-message: Public generic functions
failed-to-validate-message: Public generic functions
fun: Private ordinary functions
Function, argument: Private ordinary functions
Function, call-fun-check-true: Private ordinary functions
Function, compile-template: Public ordinary functions
Function, compile-template-entry: Private ordinary functions
Function, current-keys: Public ordinary functions
Function, define-key: Public ordinary functions
Function, fun: Private ordinary functions
Function, handle-between: Private ordinary functions
Function, handle-contents: Private ordinary functions
Function, handle-equal: Private ordinary functions
Function, handle-greater-than: Private ordinary functions
Function, handle-length: Private ordinary functions
Function, handle-less-than: Private ordinary functions
Function, handle-maxlen: Private ordinary functions
Function, handle-minlen: Private ordinary functions
Function, handle-or: Private ordinary functions
Function, handle-satisfies: Private ordinary functions
Function, handle-type: Private ordinary functions
Function, is-valid-template: Public ordinary functions
Function, keyword->function: Private ordinary functions
Function, map-plist: Private ordinary functions
Function, process-template-entry: Private ordinary functions
Function, process-template-funs: Private ordinary functions
Function, quoted-p: Private ordinary functions
Function, repeat-pattern: Public ordinary functions
Function, repeat-test: Public ordinary functions
Function, same-structures-p: Public ordinary functions
Function, signal-bad-template-format: Private ordinary functions
Function, signal-failed-to-validate: Private ordinary functions
Function, signal-unknown-keyword: Private ordinary functions
Function, validate-list: Public ordinary functions

G
Generic Function, (setf bad-template-format-message): Public generic functions
Generic Function, (setf bad-template-format-signaller): Public generic functions
Generic Function, (setf bad-template-format-template): Public generic functions
Generic Function, (setf failed-to-validate-arg): Public generic functions
Generic Function, (setf failed-to-validate-entry): Public generic functions
Generic Function, (setf failed-to-validate-key): Public generic functions
Generic Function, (setf failed-to-validate-message): Public generic functions
Generic Function, (setf unknown-keyword-keyword): Public generic functions
Generic Function, (setf unknown-keyword-message): Public generic functions
Generic Function, bad-template-format-message: Public generic functions
Generic Function, bad-template-format-signaller: Public generic functions
Generic Function, bad-template-format-template: Public generic functions
Generic Function, failed-to-validate-arg: Public generic functions
Generic Function, failed-to-validate-entry: Public generic functions
Generic Function, failed-to-validate-key: Public generic functions
Generic Function, failed-to-validate-message: Public generic functions
Generic Function, unknown-keyword-keyword: Public generic functions
Generic Function, unknown-keyword-message: Public generic functions

H
handle-between: Private ordinary functions
handle-contents: Private ordinary functions
handle-equal: Private ordinary functions
handle-greater-than: Private ordinary functions
handle-length: Private ordinary functions
handle-less-than: Private ordinary functions
handle-maxlen: Private ordinary functions
handle-minlen: Private ordinary functions
handle-or: Private ordinary functions
handle-satisfies: Private ordinary functions
handle-type: Private ordinary functions

I
is-valid-template: Public ordinary functions

K
keyword->function: Private ordinary functions

M
map-plist: Private ordinary functions
Method, (setf bad-template-format-message): Public generic functions
Method, (setf bad-template-format-signaller): Public generic functions
Method, (setf bad-template-format-template): Public generic functions
Method, (setf failed-to-validate-arg): Public generic functions
Method, (setf failed-to-validate-entry): Public generic functions
Method, (setf failed-to-validate-key): Public generic functions
Method, (setf failed-to-validate-message): Public generic functions
Method, (setf unknown-keyword-keyword): Public generic functions
Method, (setf unknown-keyword-message): Public generic functions
Method, bad-template-format-message: Public generic functions
Method, bad-template-format-signaller: Public generic functions
Method, bad-template-format-template: Public generic functions
Method, failed-to-validate-arg: Public generic functions
Method, failed-to-validate-entry: Public generic functions
Method, failed-to-validate-key: Public generic functions
Method, failed-to-validate-message: Public generic functions
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, print-object: Public standalone methods
Method, unknown-keyword-keyword: Public generic functions
Method, unknown-keyword-message: Public generic functions

P
print-object: Public standalone methods
print-object: Public standalone methods
print-object: Public standalone methods
process-template-entry: Private ordinary functions
process-template-funs: Private ordinary functions

Q
quoted-p: Private ordinary functions

R
repeat-pattern: Public ordinary functions
repeat-test: Public ordinary functions

S
same-structures-p: Public ordinary functions
signal-bad-template-format: Private ordinary functions
signal-failed-to-validate: Private ordinary functions
signal-unknown-keyword: Private ordinary functions

U
unknown-keyword-keyword: Public generic functions
unknown-keyword-keyword: Public generic functions
unknown-keyword-message: Public generic functions
unknown-keyword-message: Public generic functions

V
validate-list: Public compiler macros
validate-list: Public ordinary functions