The optima Reference Manual

Table of Contents

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

The optima Reference Manual

This is the optima Reference Manual, version 1.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:21:11 2018 GMT+0.


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

1 Introduction

optima - Optimized Pattern Matching Library

optima is a fast pattern matching library which uses optimizing techniques widely used in the functional programming world. See the following references for more details:

Pattern Language

A pattern specifier, or a pattern for short ambiguous, is an expression that describes how a value matches some specification. Pattern specifiers are defined as follows:

pattern-specifier ::= constant-pattern
                    | variable-pattern
                    | place-pattern
                    | guard-pattern
                    | not-pattern
                    | or-pattern
                    | and-pattern
                    | constructor-pattern
                    | derived-pattern
constant-pattern ::= t | nil
                   | keyword
                   | atom-except-symbol
                   | (quote VALUE)
variable-pattern ::= SYMBOL | (variable SYMBOL)
place-pattern ::= (place SYMBOL)
guard-pattern ::= (guard PATTERN TEST-FORM)
not-pattern ::= (not PATTERN)
or-pattern ::= (or PATTERN*)
and-pattern ::= (and PATTERN*)
constructor-pattern ::= (NAME ARG*)
derived-pattern ::= (NAME PATTERN*)

Constant-Pattern

A constant-pattern matches the constant itself.

Examples:

(match 1 (1 2)) => 2
(match "foo" ("foo" "bar")) => "bar"
(match '(1) ('(1) 2)) => 2

Variable-Pattern

A variable-pattern matches any value and binds the value to the variable. "_" and "otherwise" are special variable-patterns (a.k.a wildcard-pattern) which match any value but don't bind.

Examples:

(match 1 (x x)) => 1
(match 1 (_ 2)) => 2
(match 1
  (2 2)
  (otherwise 'otherwise))
=> OTHERWISE

Place-Pattern

A place-pattern matches any value, in the same way as variable-patterns do, but binds the value by using SYMBOL-MACROLET.

Examples:

(defvar c (cons 1 2))
(match c ((cons (place x) y) (incf x) (incf y)))
c
 => (2 . 2)

Guard-Pattern

A guard-pattern is a special pattern that tests whether TEST-FORM is satisfied in the current matching context.

Examples:

(match 1 ((guard x (eql x 2)) t))
=> NIL
(match 1 ((guard x (eql x 1)) t))
=> T

Not-Pattern

A not-pattern matches a value that is not matched with sub-PATTERN.

Examples:

(match 1 ((not 2) 3)) => 3
(match 1 ((not (not 1)) 1)) => 1

Or-Pattern

An or-pattern matches a value that is matched with one of sub-PATTERNs.

Examples:

(match '(2 . 1) ((or (cons 1 x) (cons 2 x)) x))
=> 1

And-Pattern

An and-pattern matches a value that is matched with all of its sub-PATTERNs. The most common use case is to match a value and bind the value to a variable.

Examples:

(match 1 ((and 1 x) x))
=> 1

Constructor-Pattern

A constructor-pattern matches the sub-components of a value based on its structure. The following constructors are available:

CONS

Syntax:

cons-constructor-pattern ::= (cons CAR-PATTERN CDR-PATTERN)

Examples:

(match '(1 . 2)
  ((cons a b) (+ a b)))
 => 3

ASSOC

Syntax:

assoc-constructor-pattern ::= (assoc ITEM PATTERN &key key test)

Examples:

(match '((1 . :one))
  ((assoc 1 x) x))
=> :ONE
(match '((1 . :one) (2 . :two))
  ((assoc 2 x) x))
=> :TWO
(match '(1 (2 . 3))
  ((assoc 2 x) x))
=> 3
(match '(("a" . 123))
  ((assoc "A" 123 :test #'string-equal) t))
=> T

PROPERTY

Syntax:

property-constructor-pattern ::= (property KEY PATTERN)

Examples:

(match '(:a 1)
  ((property :a x) x))
=> 1
(match '(:a 1 :b 2)
  ((property :b x) x))
=> 2
(match '(:a 1 2)
  ((property :a x) x))
=> 1

VECTOR

Syntax:

vector-constructor-pattern ::= (vector PATTERN*)

Examples:

(match #(1 2)
  ((vector a b) (+ a b)))
=> 3

SIMPLE-VECTOR

Syntax:

simple-vector-constructor-pattern ::= (simple-vector PATTERN*)

Examples:

(match #(1 2)
  ((simple-vector a b) (+ a b)))
=> 3

CLASS

Matches an instance of a given subclass of standard-class, as well as the instance's slots.

Syntax:

class-constructor-pattern ::= (class NAME slot*)
                            | (NAME slot*)
slot ::= SLOT-NAME
       | (SLOT-NAME PATTERN*)

CLASS can be omitted. If slot is a symbol, then it will be regarded as (slot slot). If more than one PATTERN is given, then they will be wrapped by and-pattern like (and PATTERN*).

Examples:

(defclass point ()
  ((x :initarg :x)
   (y :initarg :y)))
(defvar p (make-instance 'point :x 1 :y 2))
(match p
  ((point x y) (list x y)))
=> (1 2)
(match p
  ((point (x 1 x)) x))
=> 1
(defstruct person (name age))
(defvar foo (make-person :name "foo" :age 30))
(match foo
  ((person name age) (list name age)))
=> ("foo" 30)

You can also use MAKE-INSTANCE style pattern syntax like:

(match foo
  ((person :name name :age age) (list name age)))
=> ("foo" 30)

This is equal to the example above except this implicitly resolves the slot names using the Metaobject Protocol. In this case, you have to make sure the slot names can be determined uniquely during the compilation. Otherwise, you will get a compiler error.

STRUCTURE

Matches any structure value, and its slot values.

Syntax:

structure-constructor-pattern ::= (structure CONC-NAME slot*)
                                | (CONC-NAME slot*)
slot ::= SLOT-NAME
       | (SLOT-NAME PATTERN*)

As in the CLASS constructor-pattern, STRUCTURE can be omitted. CONC-NAME is a prefix string of a predicate (CONC-NAME + "p") and accessors (CONC-NAME + SLOT-NAME). For example, if we have the following defstruct,

(defstruct person name age)

the structure constructor-pattern (person- name age) is valid because PERSON-P, PERSON-NAME and PERSON-AGE are available here. Technically, we don't need an actual structure definition. If we have the following code, for instance,

(defun point-p (p) (consp p))
(defun point-x (p) (car p))
(defun point-y (p) (cdr p))

the pattern matching below is valid.

(match (cons 1 2)
  ((point- x y) (list x y)))
=> (1 2)

Examples:

(defstruct (person (:conc-name :p-)
                   (:predicate p-p))
  name age)
(match (make-person :name "foo" :age 30)
  ((p- name age) (list name age)))
=> ("foo" 30)

As in the class constructor-pattern, you can also use MAKE-INSTANCE style pattern syntax like:

(match (cons 1 2)
  ((point- :x x :y y) (list x y)))
=> (1 2)

Derived-Pattern

A derived-pattern is a pattern that is defined with DEFPATTERN. There are some builtin derived patterns as below:

LIST

Expansion of LIST derived patterns:

(list a b c) => (cons a (cons b (cons c nil)))

LIST*

Expansion of LIST* derived patterns:

(list* a b c) => (cons a (cons b c))

SATISFIES

Expansion of SATISFIES derived patterns:

(satisfies f) => (guard it (f it))

EQ, EQL, EQUAL, EQUALP

Expansion of EQ, EQL, EQUAL, EQUALP derived patterns:

(eq 'foo) => (guard it (eq it 'foo))
(eql 123) => (guard it (eql it 123))
(equal '(1 2)) => (guard it (equal it '(1 2)))
(equalp "foo") => (guard it (equalp it "foo"))

TYPE

Expansion of TYPE derived patterns:

(TYPE type) => (guard it (typep it 'type))

Quasiquotation

You may want to use a quasiquote in a pattern specifier like:

(match '(1 2 3 4)
  (`(1 ,x ,@y) (list x y)))

To do so, you need to use a specific quasiquote reader, for example fare-quasiquote , loading fare-quasiquote-optima system, because there is no standard expanded form for quasiquote expressions.

Define Constructor Patterns

You can define your own constructor patterns by using the OPTIMA.CORE package. First, define a data structure for the constructor pattern.

(defstruct (my-cons-pattern (:include constructor-pattern)
                            (:constructor make-cons-pattern (car-pattern cdr-pattern
                                                             &aux (subpatterns (list car-pattern
                                                                                     cdr-pattern))))))

Note that you must keep SUBPATTERNS of the constructor pattern in sync so that optima can take care of them.

Second, specify a condition for when the destructor of two constructor patterns can be shared. This makes it possible to perform some optimizations.

(defmethod constructor-pattern-destructor-sharable-p ((x my-cons-pattern) (y my-cons-pattern))
  t)

Third, define a destructor generator for the constructor pattern. The destructor generator will make a destructor that specifies how to check the the data (PREDICATE-FORM) and how to access the data (ACCESSOR-FORMS).

(defmethod constructor-pattern-make-destructor ((pattern my-cons-pattern) var)
  (make-destructor :predicate-form `(consp ,var)
                   :accessor-forms (list `(car ,var) `(cdr ,var))))

Finally, define a parser and an unparser for the constructor pattern.

(defmethod parse-constructor-pattern ((name (eql 'my-cons)) &rest args)
  (apply #'make-my-cons-pattern (mapcar #'parse-pattern args)))
(defmethod unparse-pattern ((pattern my-cons-pattern))
  `(cons ,(unparse-pattern (my-cons-pattern-car-pattern pattern))
         ,(unparse-pattern (my-cons-pattern-cdr-pattern pattern))))

See the source code for more detail.

[Package] optima.core

[Function] %equal

%equal a b

Equality function for comparing pattern constants.

[Macro] %equals

%equals var value

Equality macro for comparing pattern constants. This specializes the comparison form to some specific form as follows:

(equals x nil)    => (null x)
(equals x 'foo)   => (eq x 'foo)
(equals x 123)    => (eql x 123)
(equals x '(a b)) => (%equals x '(a b))

[Function] %svref

%svref simple-vector index

Safe SVREF.

[Function] %assoc

%assoc item alist &key (test #'eql)

Safe ASSOC.

[Function] %get-property

%get-property item plist

Safe GETF.

[Class] destructor

[Type] destructor

destructor

[Function] destructor-accessor-forms

destructor-accessor-forms instance

[Function] make-destructor

make-destructor &key ((bindings bindings) nil) ((predicate-form predicate-form)
                                                nil) ((accessor-forms
                                                       accessor-forms)
                                                      nil)

[Class] variable-pattern

[Type] variable-pattern

variable-pattern

[Function] variable-pattern-name

variable-pattern-name instance

[Function] make-variable-pattern

make-variable-pattern &optional name

[Class] place-pattern

[Type] place-pattern

place-pattern

[Function] place-pattern-name

place-pattern-name instance

[Function] make-place-pattern

make-place-pattern name

[Class] constant-pattern

[Type] constant-pattern

constant-pattern

[Function] constant-pattern-value

constant-pattern-value instance

[Function] make-constant-pattern

make-constant-pattern value

[Class] complex-pattern

[Type] complex-pattern

complex-pattern

[Function] complex-pattern-subpatterns

complex-pattern-subpatterns instance

[Class] guard-pattern

[Type] guard-pattern

guard-pattern

[Function] guard-pattern-test-form

guard-pattern-test-form instance

[Function] guard-pattern-subpattern

guard-pattern-subpattern pattern

[Function] make-guard-pattern

make-guard-pattern subpattern test-form &aux (subpatterns (list subpattern))

[Class] not-pattern

[Type] not-pattern

not-pattern

[Function] not-pattern-subpattern

not-pattern-subpattern pattern

[Function] make-not-pattern

make-not-pattern subpattern &aux (subpatterns (list subpattern))

[Class] or-pattern

[Type] or-pattern

or-pattern

[Function] or-pattern-subpatterns

or-pattern-subpatterns instance

[Function] make-or-pattern

make-or-pattern &rest subpatterns

[Class] and-pattern

[Type] and-pattern

and-pattern

[Function] and-pattern-subpatterns

and-pattern-subpatterns instance

[Function] make-and-pattern

make-and-pattern &rest subpatterns

[Class] constructor-pattern

[Type] constructor-pattern

constructor-pattern

[Function] constructor-pattern-subpatterns

constructor-pattern-subpatterns instance

[Function] constructor-pattern-arity

constructor-pattern-arity pattern

[Function] constructor-pattern-destructor-sharable-p

constructor-pattern-destructor-sharable-p x y

[Function] constructor-pattern-make-destructor

constructor-pattern-make-destructor pattern var

[Class] cons-pattern

[Type] cons-pattern

cons-pattern

[Function] cons-pattern-car-pattern

cons-pattern-car-pattern pattern

[Function] cons-pattern-cdr-pattern

cons-pattern-cdr-pattern pattern

[Function] make-cons-pattern

make-cons-pattern car-pattern cdr-pattern &aux (subpatterns
                                                (list car-pattern cdr-pattern))

[Class] assoc-pattern

[Type] assoc-pattern

assoc-pattern

[Function] assoc-pattern-item

assoc-pattern-item instance

[Function] assoc-pattern-key

assoc-pattern-key instance

[Function] assoc-pattern-test

assoc-pattern-test instance

[Function] assoc-pattern-value-pattern

assoc-pattern-value-pattern pattern

[Function] make-assoc-pattern

make-assoc-pattern item value-pattern &key (key nil) (test nil) &aux (subpatterns
                                                                      (list
                                                                       value-pattern))

[Class] property-pattern

[Type] property-pattern

property-pattern

[Function] property-pattern-item

property-pattern-item instance

[Function] property-pattern-value-pattern

property-pattern-value-pattern pattern

[Function] make-property-pattern

make-property-pattern item value-pattern &aux (subpatterns (list value-pattern))

[Class] vector-pattern

[Type] vector-pattern

vector-pattern

[Function] vector-pattern-subpatterns

vector-pattern-subpatterns instance

[Function] make-vector-pattern

make-vector-pattern &rest subpatterns

[Class] simple-vector-pattern

[Type] simple-vector-pattern

simple-vector-pattern

[Function] simple-vector-pattern-subpatterns

simple-vector-pattern-subpatterns instance

[Function] make-simple-vector-pattern

make-simple-vector-pattern &rest subpatterns

[Class] class-pattern

[Type] class-pattern

class-pattern

[Function] class-pattern-subpatterns

class-pattern-subpatterns instance

[Function] class-pattern-class-name

class-pattern-class-name instance

[Function] class-pattern-slot-names

class-pattern-slot-names instance

[Function] make-class-pattern

make-class-pattern class-name &rest slot-specs

[Class] structure-pattern

[Type] structure-pattern

structure-pattern

[Function] structure-pattern-subpatterns

structure-pattern-subpatterns instance

[Function] structure-pattern-conc-name

structure-pattern-conc-name instance

[Function] structure-pattern-slot-names

structure-pattern-slot-names instance

[Function] make-structure-pattern

make-structure-pattern conc-name &rest slot-specs

[Function] pattern-variables

pattern-variables pattern

Returns the set of variables in PATTERN. If PATTERN is not linear, an error will be raised.

[Function] place-pattern-included-p

place-pattern-included-p pattern

[Function] check-patterns

check-patterns patterns

Check if PATTERNS are valid. Otherwise, an error will be raised.

[Function] lift-guard-patterns

lift-guard-patterns pattern

[Function] pattern-expand-function

pattern-expand-function name

[Function] pattern-expand-1

pattern-expand-1 pattern

[Function] pattern-expand

pattern-expand pattern

[Function] pattern-expand-all

pattern-expand-all pattern

[Function] parse-pattern

parse-pattern pattern

[Function] parse-constructor-pattern

parse-constructor-pattern name &rest args

[Function] unparse-pattern

unparse-pattern pattern

[Package] optima

[Macro] match

match arg &body clauses

Matches ARG with CLAUSES. CLAUSES is a list of the form of (PATTERN . BODY) where PATTERN is a pattern specifier and BODY is an implicit progn. If ARG matches some PATTERN, match then evaluates the corresponding BODY and returns the evaluated value. If no pattern matches, then returns NIL.

Evaluating a form (FAIL) in the clause body causes the latest pattern matching to fail. For example,

(match 1
  (x (if (eql x 1)
         (fail)
         x))
  (_ 'ok))

returns OK, because the form (FAIL) in the first clause is evaluated.

If BODY starts with the symbols WHEN or UNLESS, then the next form will be used to introduce (FAIL). That is,

(match list ((list x) when (oddp x) x))
(match list ((list x) unless (evenp x) x))

will be translated to

(match list ((list x) (if (oddp x) x (fail))))
(match list ((list x) (if (evenp x) (fail) x)))

Examples:

(match 1 (1 1))
=> 1
(match 1 (2 2))
=> 2
(match 1 (x x))
=> 1
(match (list 1 2 3)
  (list x y z) (+ x y z))
=> 6

[Macro] multiple-value-match

multiple-value-match values-form &body clauses

Matches the multiple values of VALUES-FORM with CLAUSES. Unlike MATCH, CLAUSES have to have the form of (PATTERNS . BODY), where PATTERNS is a list of patterns. The number of values that will be used to match is determined by the maximum arity of PATTERNS among CLAUSES.

Examples:

(multiple-value-match (values 1 2)
 ((2) 1)
 ((1 y) y))
=> 2

[Macro] ematch

ematch arg &body clauses

Same as MATCH, except MATCH-ERROR will be raised if not matched.

[Macro] multiple-value-ematch

multiple-value-ematch values-form &body clauses

Same as MULTIPLE-VALUE-MATCH, except MATCH-ERROR will be raised if not matched.

[Macro] cmatch

cmatch arg &body clauses

Same as MATCH, except a continuable MATCH-ERROR will be raised if none of the clauses match.

[Macro] multiple-value-cmatch

multiple-value-cmatch values-form &body clauses

Same as MULTIPLE-VALUE-MATCH, except a continuable MATCH-ERROR will be raised if none of the clauses match.

[Macro] fail

fail

Causes the latest pattern matching to fail. After this failure, matching continues at the next pattern.

[Class] match-error

[Type] match-error

match-error

[Function] match-error-values

match-error-values condition

[Function] match-error-patterns

match-error-patterns condition

[Macro] defpattern

defpattern name lambda-list &body body

Defines a derived pattern specifier named NAME. This is analogous to DEFTYPE.

Examples:

;; Defines a LIST pattern.
(defpattern list (&rest args)
  (when args
    `(cons ,(car args) (list ,@(cdr args)))))

[Package] optima.extra

[Pattern] alist

Syntax:

(alist (KEY . PATTERN)*)

Expansion:

(alist (k . p)*) => (and (assoc k p)*)

Examples:

(match '((1 . :one) (2 . :two) (3 . :three))
  ((alist (1 . x) (3 . y)) (list x y)))
=> (:ONE :THREE)

[Pattern] plist

Syntax:

(plist {KEY PATTERN}*)

Expansion:

(plist {k p}*) => (and (property k p)*)

Examples:

(match '(:name "John" :age 23)
  ((plist :name "John" :age age) age))
=> 23

[Macro] if-match

if-match pattern arg &body (then &optional else)

Equivalent to (match ARG (PATTERN THEN) (otherwise ELSE)).

[Macro] when-match

when-match pattern arg &body body

Equivalent to (match ARG (PATTERN BODY...)).

[Macro] unless-match

unless-match pattern arg &body body

Equivalent to (match ARG (PATTERN) (otherwise BODY...)).

[Macro] let-match

let-match bindings &body body

Similar to LET, except not only a variable but also a pattern can be used in BINDINGS.

[Macro] let-match*

let-match* bindings &body body

Similar to LET-MATCH but matches sequentially.

[Macro] let-match1

let-match1 pattern arg &body body

Equivalent to (let-match ((PATTERN ARG)) BODY...).

[Macro] lambda-match

lambda-match &body clauses

Equivalent to (lambda (arg) (match arg CLAUSES...)).

[Macro] lambda-ematch

lambda-ematch &body clauses

Equivalent to (lambda (arg) (ematch arg CLAUSES...)).

[Macro] lambda-cmatch

lambda-cmatch &body clauses

Equivalent to (lambda (arg) (cmatch arg CLAUSES...)).

[Macro] lambda-match1

lambda-match1 pattern &body body

Equivalent to (lambda-match (PATTERN BODY...)).

[Macro] lambda-ematch1

lambda-ematch1 pattern &body body

Equivalent to (lambda-ematch (PATTERN BODY...)).

[Macro] lambda-cmatch1

lambda-cmatch1 pattern &body body

Equivalent to (lambda-cmatch (PATTERN BODY...)).

Authors

License

LLGPL

optima.ppcre - CL-PPCRE support for optima

[Package] optima.ppcre

[Pattern] ppcre

Syntax:

(ppcre REGEXP PATTERN*)

Matches REGEXP against the target string. Sub-PATTERNs will be used to match the matched groups, if the REGEXP matched.

Examples:

(match "2012-11-04"
  ((ppcre "^(\\d{4})-(\\d{2})-(\\d{2})$" year month day)
   (list year month day)))
=> ("2012" "11" "04")

Authors

License

LLGPL


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 optima

Author

Tomohiro Matsuyama

License

LLGPL

Description

Optimized Pattern Matching Library

Long Description

optima is a fast pattern matching library which
uses optimizing techniques widely used in the functional programming
world. See the following references for more details:

* [Optimizing Pattern Matching](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.6.5507) by Fabrice Le Fessant, Luc Maranget
* [The Implementation of Functional Programming Languages](http://research.microsoft.com/en-us/um/people/simonpj/papers/slpj-book-1987/) by Simon Peyton Jones

Pattern Language
—————-

A pattern specifier, or a pattern for short ambiguous, is an
expression that describes how a value matches some
specification. Pattern specifiers are defined as follows:

pattern-specifier ::= constant-pattern
| variable-pattern
| place-pattern
| guard-pattern
| not-pattern
| or-pattern
| and-pattern
| constructor-pattern
| derived-pattern
constant-pattern ::= t | nil
| keyword
| atom-except-symbol
| (quote VALUE)
variable-pattern ::= SYMBOL | (variable SYMBOL)
place-pattern ::= (place SYMBOL)
guard-pattern ::= (guard PATTERN TEST-FORM)
not-pattern ::= (not PATTERN)
or-pattern ::= (or PATTERN*)
and-pattern ::= (and PATTERN*)
constructor-pattern ::= (NAME ARG*)
derived-pattern ::= (NAME PATTERN*)

### Constant-Pattern

A constant-pattern matches the constant itself.

Examples:

(match 1 (1 2)) => 2
(match "foo" ("foo" "bar")) => "bar"
(match ’(1) (’(1) 2)) => 2

### Variable-Pattern

A variable-pattern matches any value and binds the value to the
variable. "_" and "otherwise" are special variable-patterns (a.k.a
wildcard-pattern) which match any value but don’t bind.

Examples:

(match 1 (x x)) => 1
(match 1 (_ 2)) => 2
(match 1
(2 2)
(otherwise ’otherwise))
=> OTHERWISE

### Place-Pattern

A place-pattern matches any value, in the same way as
variable-patterns do, but binds the value by using SYMBOL-MACROLET.

Examples:

(defvar c (cons 1 2))
(match c ((cons (place x) y) (incf x) (incf y)))
c
=> (2 . 2)

### Guard-Pattern

A guard-pattern is a special pattern that tests whether TEST-FORM is
satisfied in the current matching context.

Examples:

(match 1 ((guard x (eql x 2)) t))
=> NIL
(match 1 ((guard x (eql x 1)) t))
=> T

### Not-Pattern

A not-pattern matches a value that is not matched with sub-PATTERN.

Examples:

(match 1 ((not 2) 3)) => 3
(match 1 ((not (not 1)) 1)) => 1

### Or-Pattern

An or-pattern matches a value that is matched with one of
sub-PATTERNs.

Examples:

(match ’(2 . 1) ((or (cons 1 x) (cons 2 x)) x))
=> 1

### And-Pattern

An and-pattern matches a value that is matched with all of its
sub-PATTERNs. The most common use case is to match a value and bind
the value to a variable.

Examples:

(match 1 ((and 1 x) x))
=> 1

### Constructor-Pattern

A constructor-pattern matches the sub-components of a value based on
its structure. The following constructors are available:

#### CONS

Syntax:

cons-constructor-pattern ::= (cons CAR-PATTERN CDR-PATTERN)

Examples:

(match ’(1 . 2)
((cons a b) (+ a b)))
=> 3

#### ASSOC

Syntax:

assoc-constructor-pattern ::= (assoc ITEM PATTERN &key key test)

Examples:

(match ’((1 . :one))
((assoc 1 x) x))
=> :ONE
(match ’((1 . :one) (2 . :two))
((assoc 2 x) x))
=> :TWO
(match ’(1 (2 . 3))
((assoc 2 x) x))
=> 3
(match ’(("a" . 123))
((assoc "A" 123 :test #’string-equal) t))
=> T

#### PROPERTY

Syntax:

property-constructor-pattern ::= (property KEY PATTERN)

Examples:

(match ’(:a 1)
((property :a x) x))
=> 1
(match ’(:a 1 :b 2)
((property :b x) x))
=> 2
(match ’(:a 1 2)
((property :a x) x))
=> 1

#### VECTOR

Syntax:

vector-constructor-pattern ::= (vector PATTERN*)

Examples:

(match #(1 2)
((vector a b) (+ a b)))
=> 3

#### SIMPLE-VECTOR

Syntax:

simple-vector-constructor-pattern ::= (simple-vector PATTERN*)

Examples:

(match #(1 2)
((simple-vector a b) (+ a b)))
=> 3

#### CLASS

Matches an instance of a given subclass of standard-class, as well as
the instance’s slots.

Syntax:

class-constructor-pattern ::= (class NAME slot*)
| (NAME slot*)
slot ::= SLOT-NAME
| (SLOT-NAME PATTERN*)

CLASS can be omitted. If slot is a symbol, then it will be regarded
as (slot slot). If more than one PATTERN is given, then they will be
wrapped by and-pattern like (and PATTERN*).

Examples:

(defclass point ()
((x :initarg :x)
(y :initarg :y)))
(defvar p (make-instance ’point :x 1 :y 2))
(match p
((point x y) (list x y)))
=> (1 2)
(match p
((point (x 1 x)) x))
=> 1
(defstruct person (name age))
(defvar foo (make-person :name "foo" :age 30))
(match foo
((person name age) (list name age)))
=> ("foo" 30)

You can also use MAKE-INSTANCE style pattern syntax like:

(match foo
((person :name name :age age) (list name age)))
=> ("foo" 30)

This is equal to the example above except this implicitly resolves the
slot names using the Metaobject Protocol. In this case, you have to
make sure the slot names can be determined uniquely during the
compilation. Otherwise, you will get a compiler error.

#### STRUCTURE

Matches any structure value, and its slot values.

Syntax:

structure-constructor-pattern ::= (structure CONC-NAME slot*)
| (CONC-NAME slot*)
slot ::= SLOT-NAME
| (SLOT-NAME PATTERN*)

As in the CLASS constructor-pattern, STRUCTURE can be
omitted. CONC-NAME is a prefix string of a predicate (CONC-NAME +
"p") and accessors (CONC-NAME + SLOT-NAME). For example, if we have
the following defstruct,

(defstruct person name age)

the structure constructor-pattern (person- name age) is valid because
PERSON-P, PERSON-NAME and PERSON-AGE are available here. Technically,
we don’t need an actual structure definition. If we have the following
code, for instance,

(defun point-p (p) (consp p))
(defun point-x (p) (car p))
(defun point-y (p) (cdr p))

the pattern matching below is valid.

(match (cons 1 2)
((point- x y) (list x y)))
=> (1 2)

Examples:

(defstruct (person (:conc-name :p-)
(:predicate p-p))
name age)
(match (make-person :name "foo" :age 30)
((p- name age) (list name age)))
=> ("foo" 30)

As in the class constructor-pattern, you can also use MAKE-INSTANCE
style pattern syntax like:

(match (cons 1 2)
((point- :x x :y y) (list x y)))
=> (1 2)

### Derived-Pattern

A derived-pattern is a pattern that is defined with DEFPATTERN. There
are some builtin derived patterns as below:

#### LIST

Expansion of LIST derived patterns:

(list a b c) => (cons a (cons b (cons c nil)))

#### LIST*

Expansion of LIST* derived patterns:

(list* a b c) => (cons a (cons b c))

#### SATISFIES

Expansion of SATISFIES derived patterns:

(satisfies f) => (guard it (f it))

#### EQ, EQL, EQUAL, EQUALP

Expansion of EQ, EQL, EQUAL, EQUALP derived patterns:

(eq ’foo) => (guard it (eq it ’foo))
(eql 123) => (guard it (eql it 123))
(equal ’(1 2)) => (guard it (equal it ’(1 2)))
(equalp "foo") => (guard it (equalp it "foo"))

#### TYPE

Expansion of TYPE derived patterns:

(TYPE type) => (guard it (typep it ’type))

Quasiquotation
————–

You may want to use a quasiquote in a pattern specifier like:

(match ’(1 2 3 4)
(‘(1 ,x ,@y) (list x y)))

To do so, you need to use a specific quasiquote reader, for example
[fare-quasiquote](http://cliki.net/fare-quasiquote) , loading
fare-quasiquote-optima system, because there is no standard expanded
form for quasiquote expressions.

Define Constructor Patterns
—————————

You can define your own constructor patterns by using the
‘OPTIMA.CORE‘ package. First, define a data structure for the
constructor pattern.

(defstruct (my-cons-pattern (:include constructor-pattern)
(:constructor make-cons-pattern (car-pattern cdr-pattern
&aux (subpatterns (list car-pattern cdr-pattern))))))

Note that you must keep ‘SUBPATTERNS‘ of the constructor pattern in
sync so that optima can take care of them.

Second, specify a condition for when the destructor of two constructor
patterns can be shared. This makes it possible to perform some
optimizations.

(defmethod constructor-pattern-destructor-sharable-p ((x my-cons-pattern) (y my-cons-pattern))
t)

Third, define a destructor generator for the constructor pattern. The
destructor generator will make a destructor that specifies how to
check the the data (‘PREDICATE-FORM‘) and how to access the
data (‘ACCESSOR-FORMS‘).

(defmethod constructor-pattern-make-destructor ((pattern my-cons-pattern) var)
(make-destructor :predicate-form ‘(consp ,var)
:accessor-forms (list ‘(car ,var) ‘(cdr ,var))))

Finally, define a parser and an unparser for the constructor pattern.

(defmethod parse-constructor-pattern ((name (eql ’my-cons)) &rest args)
(apply #’make-my-cons-pattern (mapcar #’parse-pattern args)))
(defmethod unparse-pattern ((pattern my-cons-pattern))
‘(cons ,(unparse-pattern (my-cons-pattern-car-pattern pattern))
,(unparse-pattern (my-cons-pattern-cdr-pattern pattern))))

See the source code for more detail.

Version

1.0

Dependencies
Source

optima.asd (file)

Component

src (module)


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

3 Modules

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


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

3.1 optima/src

Parent

optima (system)

Location

src/

Components

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

4 Files

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


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

4.1 Lisp


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

4.1.1 optima.asd

Location

optima.asd

Systems

optima (system)


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

4.1.2 optima/src/packages.lisp

Parent

src (module)

Location

src/packages.lisp

Packages

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

4.1.3 optima/src/util.lisp

Dependency

packages.lisp (file)

Parent

src (module)

Location

src/util.lisp

Internal Definitions

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

4.1.4 optima/src/runtime.lisp

Dependency

util.lisp (file)

Parent

src (module)

Location

src/runtime.lisp

Exported Definitions

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

4.1.5 optima/src/pattern.lisp

Dependency

runtime.lisp (file)

Parent

src (module)

Location

src/pattern.lisp

Exported Definitions
Internal Definitions

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

4.1.6 optima/src/fail.lisp

Dependency

pattern.lisp (file)

Parent

src (module)

Location

src/fail.lisp

Exported Definitions

fail (macro)

Internal Definitions

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

4.1.7 optima/src/compiler.lisp

Dependency

fail.lisp (file)

Parent

src (module)

Location

src/compiler.lisp

Internal Definitions

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

4.1.8 optima/src/match.lisp

Dependency

compiler.lisp (file)

Parent

src (module)

Location

src/match.lisp

Exported Definitions
Internal Definitions

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

4.1.9 optima/src/extra.lisp

Dependency

match.lisp (file)

Parent

src (module)

Location

src/extra.lisp

Exported Definitions

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

5 Packages

Packages are listed by definition order.


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

5.1 optima.extra

### [Pattern] alist

Syntax:

(alist (KEY . PATTERN)*)

Expansion:

(alist (k . p)*) => (and (assoc k p)*)

Examples:

(match ’((1 . :one) (2 . :two) (3 . :three)) ((alist (1 . x) (3 . y)) (list x y))) => (:ONE :THREE)

### [Pattern] plist

Syntax:

(plist {KEY PATTERN}*)

Expansion:

(plist {k p}*) => (and (property k p)*)

Examples:

(match ’(:name "John" :age 23)
((plist :name "John" :age age) age)) => 23

Source

packages.lisp (file)

Use List
Exported Definitions

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

5.2 optima

Source

packages.lisp (file)

Use List
Used By List

optima.extra

Exported Definitions
Internal Definitions

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

5.3 optima.core

Source

packages.lisp (file)

Use List

common-lisp

Used By List

optima

Exported Definitions

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

6 Definitions

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


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

6.1 Exported definitions


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

6.1.1 Macros

Macro: %equals VAR VALUE

Equality macro for comparing pattern constants. This specializes the comparison form to some specific form as follows:

(equals x nil) => (null x)
(equals x ’foo) => (eq x ’foo)
(equals x 123) => (eql x 123)
(equals x ’(a b)) => (%equals x ’(a b))

Package

optima.core

Source

runtime.lisp (file)

Macro: cmatch ARG &body CLAUSES

Same as MATCH, except a continuable MATCH-ERROR will be raised if none of the clauses match.

Package

optima

Source

match.lisp (file)

Macro: defpattern NAME LAMBDA-LIST &body BODY

Defines a derived pattern specifier named NAME. This is analogous to DEFTYPE.

Examples:

;; Defines a LIST pattern.
(defpattern list (&rest args)
(when args
‘(cons ,(car args) (list ,@(cdr args)))))

Package

optima

Source

pattern.lisp (file)

Macro: ematch ARG &body CLAUSES

Same as MATCH, except MATCH-ERROR will be raised if not matched.

Package

optima

Source

match.lisp (file)

Macro: fail ()

Causes the latest pattern matching to fail. After this failure, matching continues at the next pattern.

Package

optima

Source

fail.lisp (file)

Macro: if-match PATTERN ARG &body THEN

Equivalent to (match ARG (PATTERN THEN) (otherwise ELSE)).

Package

optima.extra

Source

extra.lisp (file)

Macro: lambda-cmatch &body CLAUSES

Equivalent to (lambda (arg) (cmatch arg CLAUSES...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: lambda-cmatch1 PATTERN &body BODY

Equivalent to (lambda-cmatch (PATTERN BODY...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: lambda-ematch &body CLAUSES

Equivalent to (lambda (arg) (ematch arg CLAUSES...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: lambda-ematch1 PATTERN &body BODY

Equivalent to (lambda-ematch (PATTERN BODY...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: lambda-match &body CLAUSES

Equivalent to (lambda (arg) (match arg CLAUSES...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: lambda-match1 PATTERN &body BODY

Equivalent to (lambda-match (PATTERN BODY...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: let-match BINDINGS &body BODY

Similar to LET, except not only a variable but also a pattern can be used in BINDINGS.

Package

optima.extra

Source

extra.lisp (file)

Macro: let-match* BINDINGS &body BODY

Similar to LET-MATCH but matches sequentially.

Package

optima.extra

Source

extra.lisp (file)

Macro: let-match1 PATTERN ARG &body BODY

Equivalent to (let-match ((PATTERN ARG)) BODY...).

Package

optima.extra

Source

extra.lisp (file)

Macro: match ARG &body CLAUSES

Matches ARG with CLAUSES. CLAUSES is a list of the form of (PATTERN
. BODY) where PATTERN is a pattern specifier and BODY is an implicit
progn. If ARG matches some PATTERN, ‘match‘ then evaluates
the corresponding BODY and returns the evaluated value. If no pattern matches, then returns NIL.

Evaluating a form (FAIL) in the clause body causes the latest pattern matching to fail. For example,

(match 1
(x (if (eql x 1)
(fail)
x))
(_ ’ok))

returns OK, because the form (FAIL) in the first clause is
evaluated.

If BODY starts with the symbols WHEN or UNLESS, then the next form
will be used to introduce (FAIL). That is,

(match list ((list x) when (oddp x) x))
(match list ((list x) unless (evenp x) x))

will be translated to

(match list ((list x) (if (oddp x) x (fail))))
(match list ((list x) (if (evenp x) (fail) x)))

Examples:

(match 1 (1 1))
=> 1
(match 1 (2 2))
=> 2
(match 1 (x x))
=> 1
(match (list 1 2 3)
(list x y z) (+ x y z))
=> 6

Package

optima

Source

match.lisp (file)

Macro: multiple-value-cmatch VALUES-FORM &body CLAUSES

Same as MULTIPLE-VALUE-MATCH, except a continuable MATCH-ERROR will be raised if none of the clauses match.

Package

optima

Source

match.lisp (file)

Macro: multiple-value-ematch VALUES-FORM &body CLAUSES

Same as MULTIPLE-VALUE-MATCH, except MATCH-ERROR will be raised if not matched.

Package

optima

Source

match.lisp (file)

Macro: multiple-value-match VALUES-FORM &body CLAUSES

Matches the multiple values of VALUES-FORM with CLAUSES. Unlike MATCH, CLAUSES have to have the form of (PATTERNS . BODY), where PATTERNS is a list of patterns. The number of values that will be used to match is determined by the maximum arity of PATTERNS among CLAUSES.

Examples:

(multiple-value-match (values 1 2)
((2) 1)
((1 y) y))
=> 2

Package

optima

Source

match.lisp (file)

Macro: unless-match PATTERN ARG &body BODY

Equivalent to (match ARG (PATTERN) (otherwise BODY...)).

Package

optima.extra

Source

extra.lisp (file)

Macro: when-match PATTERN ARG &body BODY

Equivalent to (match ARG (PATTERN BODY...)).

Package

optima.extra

Source

extra.lisp (file)


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

6.1.2 Functions

Function: %assoc ITEM ALIST &key TEST

Safe ASSOC.

Package

optima.core

Source

runtime.lisp (file)

Function: %equal A B

Equality function for comparing pattern constants.

Package

optima.core

Source

runtime.lisp (file)

Function: %get-property ITEM PLIST

Safe GETF.

Package

optima.core

Source

runtime.lisp (file)

Function: %svref SIMPLE-VECTOR INDEX

Safe SVREF.

Package

optima.core

Source

runtime.lisp (file)

Function: and-pattern-subpatterns INSTANCE
Function: (setf and-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: assoc-pattern-item INSTANCE
Function: (setf assoc-pattern-item) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: assoc-pattern-key INSTANCE
Function: (setf assoc-pattern-key) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: assoc-pattern-test INSTANCE
Function: (setf assoc-pattern-test) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: assoc-pattern-value-pattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: check-patterns PATTERNS

Check if PATTERNS are valid. Otherwise, an error will be raised.

Package

optima.core

Source

pattern.lisp (file)

Function: class-pattern-class-name INSTANCE
Function: (setf class-pattern-class-name) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: class-pattern-slot-names INSTANCE
Function: (setf class-pattern-slot-names) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: class-pattern-subpatterns INSTANCE
Function: (setf class-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: complex-pattern-subpatterns INSTANCE
Function: (setf complex-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: cons-pattern-car-pattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: cons-pattern-cdr-pattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: constant-pattern-value INSTANCE
Function: (setf constant-pattern-value) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: constructor-pattern-arity PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: constructor-pattern-subpatterns INSTANCE
Function: (setf constructor-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: destructor-accessor-forms INSTANCE
Function: (setf destructor-accessor-forms) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: guard-pattern-subpattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: guard-pattern-test-form INSTANCE
Function: (setf guard-pattern-test-form) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: lift-guard-patterns PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: make-and-pattern &rest SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-assoc-pattern ITEM VALUE-PATTERN &key KEY TEST &aux SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-class-pattern CLASS-NAME &rest SLOT-SPECS
Package

optima.core

Source

pattern.lisp (file)

Function: make-cons-pattern CAR-PATTERN CDR-PATTERN &aux SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-constant-pattern VALUE
Package

optima.core

Source

pattern.lisp (file)

Function: make-destructor &key (BINDINGS BINDINGS) (PREDICATE-FORM PREDICATE-FORM) (ACCESSOR-FORMS ACCESSOR-FORMS)
Package

optima.core

Source

pattern.lisp (file)

Function: make-guard-pattern SUBPATTERN TEST-FORM &aux SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-not-pattern SUBPATTERN &aux SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-or-pattern &rest SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-place-pattern NAME
Package

optima.core

Source

pattern.lisp (file)

Function: make-property-pattern ITEM VALUE-PATTERN &aux SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-simple-vector-pattern &rest SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: make-structure-pattern CONC-NAME &rest SLOT-SPECS
Package

optima.core

Source

pattern.lisp (file)

Function: make-variable-pattern &optional NAME
Package

optima.core

Source

pattern.lisp (file)

Function: make-vector-pattern &rest SUBPATTERNS
Package

optima.core

Source

pattern.lisp (file)

Function: not-pattern-subpattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: or-pattern-subpatterns INSTANCE
Function: (setf or-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: parse-pattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: pattern-expand PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: pattern-expand-1 PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: pattern-expand-all PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: pattern-expand-function NAME
Function: (setf pattern-expand-function) FUNCTION NAME
Package

optima.core

Source

pattern.lisp (file)

Function: pattern-variables PATTERN

Returns the set of variables in PATTERN. If PATTERN is not linear, an error will be raised.

Package

optima.core

Source

pattern.lisp (file)

Function: place-pattern-included-p PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: place-pattern-name INSTANCE
Function: (setf place-pattern-name) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: property-pattern-item INSTANCE
Function: (setf property-pattern-item) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: property-pattern-value-pattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Function: simple-vector-pattern-subpatterns INSTANCE
Function: (setf simple-vector-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: structure-pattern-conc-name INSTANCE
Function: (setf structure-pattern-conc-name) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: structure-pattern-slot-names INSTANCE
Function: (setf structure-pattern-slot-names) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: structure-pattern-subpatterns INSTANCE
Function: (setf structure-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: variable-pattern-name INSTANCE
Function: (setf variable-pattern-name) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)

Function: vector-pattern-subpatterns INSTANCE
Function: (setf vector-pattern-subpatterns) VALUE INSTANCE
Package

optima.core

Source

pattern.lisp (file)


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

6.1.3 Generic functions

Generic Function: constructor-pattern-destructor-sharable-p X Y
Package

optima.core

Source

pattern.lisp (file)

Methods
Method: constructor-pattern-destructor-sharable-p (X structure-pattern) (Y structure-pattern)
Method: constructor-pattern-destructor-sharable-p (X class-pattern) (Y class-pattern)
Method: constructor-pattern-destructor-sharable-p (X simple-vector-pattern) (Y simple-vector-pattern)
Method: constructor-pattern-destructor-sharable-p (X vector-pattern) (Y vector-pattern)
Method: constructor-pattern-destructor-sharable-p (X property-pattern) (Y property-pattern)
Method: constructor-pattern-destructor-sharable-p (X assoc-pattern) (Y assoc-pattern)
Method: constructor-pattern-destructor-sharable-p (X cons-pattern) (Y cons-pattern)
Generic Function: constructor-pattern-make-destructor PATTERN VAR
Package

optima.core

Source

pattern.lisp (file)

Methods
Method: constructor-pattern-make-destructor (PATTERN structure-pattern) VAR
Method: constructor-pattern-make-destructor (PATTERN class-pattern) VAR
Method: constructor-pattern-make-destructor (PATTERN simple-vector-pattern) VAR
Method: constructor-pattern-make-destructor (PATTERN vector-pattern) VAR
Method: constructor-pattern-make-destructor (PATTERN property-pattern) VAR
Method: constructor-pattern-make-destructor (PATTERN assoc-pattern) VAR
Method: constructor-pattern-make-destructor (PATTERN cons-pattern) VAR
Generic Function: match-error-patterns CONDITION
Package

optima

Methods
Method: match-error-patterns (CONDITION match-error)
Source

match.lisp (file)

Generic Function: match-error-values CONDITION
Package

optima

Methods
Method: match-error-values (CONDITION match-error)
Source

match.lisp (file)

Generic Function: parse-constructor-pattern NAME &rest ARGS
Package

optima.core

Source

pattern.lisp (file)

Methods
Method: parse-constructor-pattern NAME &rest SLOT-SPECS
Method: parse-constructor-pattern (NAME (eql structure)) &rest ARGS
Method: parse-constructor-pattern (NAME (eql class)) &rest ARGS
Method: parse-constructor-pattern (NAME (eql simple-vector)) &rest ARGS
Method: parse-constructor-pattern (NAME (eql vector)) &rest ARGS
Method: parse-constructor-pattern (NAME (eql property)) &rest ARGS
Method: parse-constructor-pattern (NAME (eql assoc)) &rest ARGS
Method: parse-constructor-pattern (NAME (eql cons)) &rest ARGS
Generic Function: unparse-pattern PATTERN
Package

optima.core

Source

pattern.lisp (file)

Methods
Method: unparse-pattern (PATTERN structure-pattern)
Method: unparse-pattern (PATTERN class-pattern)
Method: unparse-pattern (PATTERN simple-vector-pattern)
Method: unparse-pattern (PATTERN vector-pattern)
Method: unparse-pattern (PATTERN property-pattern)
Method: unparse-pattern (PATTERN assoc-pattern)
Method: unparse-pattern (PATTERN cons-pattern)
Method: unparse-pattern (PATTERN and-pattern)
Method: unparse-pattern (PATTERN or-pattern)
Method: unparse-pattern (PATTERN not-pattern)
Method: unparse-pattern (PATTERN guard-pattern)
Method: unparse-pattern (PATTERN constant-pattern)
Method: unparse-pattern (PATTERN place-pattern)
Method: unparse-pattern (PATTERN variable-pattern)

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

6.1.4 Conditions

Condition: match-error ()
Package

optima

Source

match.lisp (file)

Direct superclasses

error (condition)

Direct methods
Direct slots
Slot: values
Initargs

:values

Initform

(quote nil)

Readers

match-error-values (generic function)

Slot: patterns
Initargs

:patterns

Initform

(quote nil)

Readers

match-error-patterns (generic function)


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

6.1.5 Structures

Structure: and-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

complex-pattern (structure)

Direct methods

unparse-pattern (method)

Structure: assoc-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods
Direct slots
Slot: item
Readers

assoc-pattern-item (function)

Writers

(setf assoc-pattern-item) (function)

Slot: key
Readers

assoc-pattern-key (function)

Writers

(setf assoc-pattern-key) (function)

Slot: test
Readers

assoc-pattern-test (function)

Writers

(setf assoc-pattern-test) (function)

Structure: class-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods
Direct slots
Slot: class-name
Readers

class-pattern-class-name (function)

Writers

(setf class-pattern-class-name) (function)

Slot: slot-names
Readers

class-pattern-slot-names (function)

Writers

(setf class-pattern-slot-names) (function)

Structure: complex-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

pattern (structure)

Direct subclasses
Direct slots
Slot: subpatterns
Readers

complex-pattern-subpatterns (function)

Writers

(setf complex-pattern-subpatterns) (function)

Structure: cons-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods
Structure: constant-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

pattern (structure)

Direct methods

unparse-pattern (method)

Direct slots
Slot: value
Readers

constant-pattern-value (function)

Writers

(setf constant-pattern-value) (function)

Structure: constructor-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

complex-pattern (structure)

Direct subclasses
Structure: destructor ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: bindings
Readers

destructor-bindings (function)

Writers

(setf destructor-bindings) (function)

Slot: predicate-form
Readers

destructor-predicate-form (function)

Writers

(setf destructor-predicate-form) (function)

Slot: accessor-forms
Readers

destructor-accessor-forms (function)

Writers

(setf destructor-accessor-forms) (function)

Structure: guard-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

complex-pattern (structure)

Direct methods

unparse-pattern (method)

Direct slots
Slot: test-form
Readers

guard-pattern-test-form (function)

Writers

(setf guard-pattern-test-form) (function)

Structure: not-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

complex-pattern (structure)

Direct methods

unparse-pattern (method)

Structure: or-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

complex-pattern (structure)

Direct methods

unparse-pattern (method)

Structure: place-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

pattern (structure)

Direct methods

unparse-pattern (method)

Direct slots
Slot: name
Readers

place-pattern-name (function)

Writers

(setf place-pattern-name) (function)

Structure: property-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods
Direct slots
Slot: item
Readers

property-pattern-item (function)

Writers

(setf property-pattern-item) (function)

Structure: simple-vector-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods
Structure: structure-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods
Direct slots
Slot: conc-name
Readers

structure-pattern-conc-name (function)

Writers

(setf structure-pattern-conc-name) (function)

Slot: slot-names
Readers

structure-pattern-slot-names (function)

Writers

(setf structure-pattern-slot-names) (function)

Structure: variable-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

pattern (structure)

Direct methods

unparse-pattern (method)

Direct slots
Slot: name
Readers

variable-pattern-name (function)

Writers

(setf variable-pattern-name) (function)

Structure: vector-pattern ()
Package

optima.core

Source

pattern.lisp (file)

Direct superclasses

constructor-pattern (structure)

Direct methods

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

6.2 Internal definitions


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

6.2.1 Special variables

Special Variable: *debug-compiler*
Package

optima

Source

compiler.lisp (file)


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

6.2.2 Symbol macros

Symbol Macro: %fail
Package

optima

Source

fail.lisp (file)

Expansion

(error "not pattern matching.")


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

6.2.3 Macros

Macro: %if TEST THEN ELSE

Similar to IF except %IF also allows to call (FAIL) in THEN branch to jump to ELSE branch.

Package

optima

Source

fail.lisp (file)

Macro: %match VARS CLAUSES ELSE

Compiler cushion macro. This is useful for seeing and debugging the process of pattern matching compiler.

Package

optima

Source

compiler.lisp (file)

Macro: %or &rest FORMS

Causes the latest pattern matching to fail. After this failure, matching continues at the next pattern.

Package

optima

Source

fail.lisp (file)

Macro: cmatch* ARGS &body CLAUSES
Package

optima

Source

match.lisp (file)

Macro: ematch* ARGS &body CLAUSES
Package

optima

Source

match.lisp (file)

Macro: match* ARGS &body CLAUSES
Package

optima

Source

match.lisp (file)

Macro: once-only* SYMBOL &body BODY
Package

optima

Source

util.lisp (file)


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

6.2.4 Functions

Function: %compile-match VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: %make-class-pattern &key (SUBPATTERNS SUBPATTERNS) (CLASS-NAME CLASS-NAME) (SLOT-NAMES SLOT-NAMES)
Package

optima

Source

pattern.lisp (file)

Function: %make-structure-pattern &key (SUBPATTERNS SUBPATTERNS) (CONC-NAME CONC-NAME) (SLOT-NAMES SLOT-NAMES)
Package

optima

Source

pattern.lisp (file)

Function: %make-variable-pattern NAME
Package

optima

Source

pattern.lisp (file)

Function: and-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: assoc-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: assoc-pattern-subpatterns INSTANCE
Function: (setf assoc-pattern-subpatterns) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: class-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: compile-clause-body BODY
Package

optima

Source

compiler.lisp (file)

Function: compile-match VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-1 FORM CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-constant-group VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-constructor-group VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-empty-group CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-fail FORM ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-group VARS GROUP ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-groups VARS GROUPS ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-not-group VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-or-group VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-place-group VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-match-variable-group VARS CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: compile-multiple-value-match VALUES-FORM CLAUSES ELSE
Package

optima

Source

compiler.lisp (file)

Function: complex-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: cons-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: cons-pattern-subpatterns INSTANCE
Function: (setf cons-pattern-subpatterns) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: constant-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: constructor-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: copy-and-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-assoc-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-class-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-complex-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-cons-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-constant-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-constructor-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-destructor INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-guard-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-not-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-or-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-place-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-property-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-simple-vector-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-structure-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-variable-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: copy-vector-pattern INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: destructor-bindings INSTANCE
Function: (setf destructor-bindings) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: destructor-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: destructor-predicate-form INSTANCE
Function: (setf destructor-predicate-form) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: group LIST &key TEST KEY
Package

optima

Source

util.lisp (file)

Function: group-match-clauses CLAUSES
Package

optima

Source

compiler.lisp (file)

Function: guard-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: guard-pattern-subpatterns INSTANCE
Function: (setf guard-pattern-subpatterns) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: lift-guard-patterns-1 PATTERN

Lifts GUARD patterns in PATTERN so that the guards can see any variables in PATTERN. The transform looks like:

(list x (guard y (equal x y)))
=> (guard (list x y) (equal x y))

Multiple guards will be connected with conjunction in order of occurence like:

(list (guard x (consp x)) (guard y (eq y (car x)))) => (guard (list x (guard y (eq y (car x)))) (consp x)) => (guard (guard (list x y) (eq y (car x))) (consp x)) => (guard (list x y) (and (consp x) (eq y (car x))))

Package

optima

Source

pattern.lisp (file)

Function: lift-guard-patterns-2 PATTERN

Lifts OR patterns that include guards like:

(list 3 (or 1 (guard x (evenp x))))
=> (or (list 3 1) (list 3 (guard x (evenp x)))) => (or (list 3 1) (guard (list 3 x) (evenp x)))

Package

optima

Source

pattern.lisp (file)

Function: make-complex-pattern &key (SUBPATTERNS SUBPATTERNS)
Package

optima

Source

pattern.lisp (file)

Function: make-constructor-pattern &key (SUBPATTERNS SUBPATTERNS)
Package

optima

Source

pattern.lisp (file)

Function: make-pattern &key
Package

optima

Source

pattern.lisp (file)

Function: not-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: not-pattern-subpatterns INSTANCE
Function: (setf not-pattern-subpatterns) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: or-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: parse-class-pattern CLASS-NAME &rest SLOT-SPECS
Package

optima

Source

pattern.lisp (file)

Function: parse-structure-pattern CONC-NAME &rest SLOT-SPECS
Package

optima

Source

pattern.lisp (file)

Function: pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: place-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: preprocess-match-clause CLAUSE
Package

optima

Source

compiler.lisp (file)

Function: preprocess-match-clauses VARS CLAUSES
Package

optima

Source

compiler.lisp (file)

Function: property-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: property-pattern-subpatterns INSTANCE
Function: (setf property-pattern-subpatterns) VALUE INSTANCE
Package

optima

Source

pattern.lisp (file)

Function: self-evaluating-object-p OBJECT
Package

optima

Source

util.lisp (file)

Function: set-equal SET1 SET2
Package

optima

Source

util.lisp (file)

Function: simple-vector-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: span LIST &key TEST KEY
Package

optima

Source

util.lisp (file)

Function: structure-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: variable-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)

Function: vector-pattern-p OBJECT
Package

optima

Source

pattern.lisp (file)


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

6.2.5 Structures

Structure: pattern ()
Package

optima

Source

pattern.lisp (file)

Direct superclasses

structure-object (structure)

Direct subclasses
Direct methods

print-object (method)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   M   O  
Index Entry  Section

F
File, Lisp, optima.asd: The optima<dot>asd file
File, Lisp, optima/src/compiler.lisp: The optima/src/compiler<dot>lisp file
File, Lisp, optima/src/extra.lisp: The optima/src/extra<dot>lisp file
File, Lisp, optima/src/fail.lisp: The optima/src/fail<dot>lisp file
File, Lisp, optima/src/match.lisp: The optima/src/match<dot>lisp file
File, Lisp, optima/src/packages.lisp: The optima/src/packages<dot>lisp file
File, Lisp, optima/src/pattern.lisp: The optima/src/pattern<dot>lisp file
File, Lisp, optima/src/runtime.lisp: The optima/src/runtime<dot>lisp file
File, Lisp, optima/src/util.lisp: The optima/src/util<dot>lisp file

L
Lisp File, optima.asd: The optima<dot>asd file
Lisp File, optima/src/compiler.lisp: The optima/src/compiler<dot>lisp file
Lisp File, optima/src/extra.lisp: The optima/src/extra<dot>lisp file
Lisp File, optima/src/fail.lisp: The optima/src/fail<dot>lisp file
Lisp File, optima/src/match.lisp: The optima/src/match<dot>lisp file
Lisp File, optima/src/packages.lisp: The optima/src/packages<dot>lisp file
Lisp File, optima/src/pattern.lisp: The optima/src/pattern<dot>lisp file
Lisp File, optima/src/runtime.lisp: The optima/src/runtime<dot>lisp file
Lisp File, optima/src/util.lisp: The optima/src/util<dot>lisp file

M
Module, optima/src: The optima/src module

O
optima.asd: The optima<dot>asd file
optima/src: The optima/src module
optima/src/compiler.lisp: The optima/src/compiler<dot>lisp file
optima/src/extra.lisp: The optima/src/extra<dot>lisp file
optima/src/fail.lisp: The optima/src/fail<dot>lisp file
optima/src/match.lisp: The optima/src/match<dot>lisp file
optima/src/packages.lisp: The optima/src/packages<dot>lisp file
optima/src/pattern.lisp: The optima/src/pattern<dot>lisp file
optima/src/runtime.lisp: The optima/src/runtime<dot>lisp file
optima/src/util.lisp: The optima/src/util<dot>lisp file

Jump to:   F   L   M   O  

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

A.2 Functions

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

%
%assoc: Exported functions
%compile-match: Internal functions
%equal: Exported functions
%equals: Exported macros
%get-property: Exported functions
%if: Internal macros
%make-class-pattern: Internal functions
%make-structure-pattern: Internal functions
%make-variable-pattern: Internal functions
%match: Internal macros
%or: Internal macros
%svref: Exported functions

(
(setf and-pattern-subpatterns): Exported functions
(setf assoc-pattern-item): Exported functions
(setf assoc-pattern-key): Exported functions
(setf assoc-pattern-subpatterns): Internal functions
(setf assoc-pattern-test): Exported functions
(setf class-pattern-class-name): Exported functions
(setf class-pattern-slot-names): Exported functions
(setf class-pattern-subpatterns): Exported functions
(setf complex-pattern-subpatterns): Exported functions
(setf cons-pattern-subpatterns): Internal functions
(setf constant-pattern-value): Exported functions
(setf constructor-pattern-subpatterns): Exported functions
(setf destructor-accessor-forms): Exported functions
(setf destructor-bindings): Internal functions
(setf destructor-predicate-form): Internal functions
(setf guard-pattern-subpatterns): Internal functions
(setf guard-pattern-test-form): Exported functions
(setf not-pattern-subpatterns): Internal functions
(setf or-pattern-subpatterns): Exported functions
(setf pattern-expand-function): Exported functions
(setf place-pattern-name): Exported functions
(setf property-pattern-item): Exported functions
(setf property-pattern-subpatterns): Internal functions
(setf simple-vector-pattern-subpatterns): Exported functions
(setf structure-pattern-conc-name): Exported functions
(setf structure-pattern-slot-names): Exported functions
(setf structure-pattern-subpatterns): Exported functions
(setf variable-pattern-name): Exported functions
(setf vector-pattern-subpatterns): Exported functions

A
and-pattern-p: Internal functions
and-pattern-subpatterns: Exported functions
assoc-pattern-item: Exported functions
assoc-pattern-key: Exported functions
assoc-pattern-p: Internal functions
assoc-pattern-subpatterns: Internal functions
assoc-pattern-test: Exported functions
assoc-pattern-value-pattern: Exported functions

C
check-patterns: Exported functions
class-pattern-class-name: Exported functions
class-pattern-p: Internal functions
class-pattern-slot-names: Exported functions
class-pattern-subpatterns: Exported functions
cmatch: Exported macros
cmatch*: Internal macros
compile-clause-body: Internal functions
compile-match: Internal functions
compile-match-1: Internal functions
compile-match-constant-group: Internal functions
compile-match-constructor-group: Internal functions
compile-match-empty-group: Internal functions
compile-match-fail: Internal functions
compile-match-group: Internal functions
compile-match-groups: Internal functions
compile-match-not-group: Internal functions
compile-match-or-group: Internal functions
compile-match-place-group: Internal functions
compile-match-variable-group: Internal functions
compile-multiple-value-match: Internal functions
complex-pattern-p: Internal functions
complex-pattern-subpatterns: Exported functions
cons-pattern-car-pattern: Exported functions
cons-pattern-cdr-pattern: Exported functions
cons-pattern-p: Internal functions
cons-pattern-subpatterns: Internal functions
constant-pattern-p: Internal functions
constant-pattern-value: Exported functions
constructor-pattern-arity: Exported functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-destructor-sharable-p: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-make-destructor: Exported generic functions
constructor-pattern-p: Internal functions
constructor-pattern-subpatterns: Exported functions
copy-and-pattern: Internal functions
copy-assoc-pattern: Internal functions
copy-class-pattern: Internal functions
copy-complex-pattern: Internal functions
copy-cons-pattern: Internal functions
copy-constant-pattern: Internal functions
copy-constructor-pattern: Internal functions
copy-destructor: Internal functions
copy-guard-pattern: Internal functions
copy-not-pattern: Internal functions
copy-or-pattern: Internal functions
copy-pattern: Internal functions
copy-place-pattern: Internal functions
copy-property-pattern: Internal functions
copy-simple-vector-pattern: Internal functions
copy-structure-pattern: Internal functions
copy-variable-pattern: Internal functions
copy-vector-pattern: Internal functions

D
defpattern: Exported macros
destructor-accessor-forms: Exported functions
destructor-bindings: Internal functions
destructor-p: Internal functions
destructor-predicate-form: Internal functions

E
ematch: Exported macros
ematch*: Internal macros

F
fail: Exported macros
Function, %assoc: Exported functions
Function, %compile-match: Internal functions
Function, %equal: Exported functions
Function, %get-property: Exported functions
Function, %make-class-pattern: Internal functions
Function, %make-structure-pattern: Internal functions
Function, %make-variable-pattern: Internal functions
Function, %svref: Exported functions
Function, (setf and-pattern-subpatterns): Exported functions
Function, (setf assoc-pattern-item): Exported functions
Function, (setf assoc-pattern-key): Exported functions
Function, (setf assoc-pattern-subpatterns): Internal functions
Function, (setf assoc-pattern-test): Exported functions
Function, (setf class-pattern-class-name): Exported functions
Function, (setf class-pattern-slot-names): Exported functions
Function, (setf class-pattern-subpatterns): Exported functions
Function, (setf complex-pattern-subpatterns): Exported functions
Function, (setf cons-pattern-subpatterns): Internal functions
Function, (setf constant-pattern-value): Exported functions
Function, (setf constructor-pattern-subpatterns): Exported functions
Function, (setf destructor-accessor-forms): Exported functions
Function, (setf destructor-bindings): Internal functions
Function, (setf destructor-predicate-form): Internal functions
Function, (setf guard-pattern-subpatterns): Internal functions
Function, (setf guard-pattern-test-form): Exported functions
Function, (setf not-pattern-subpatterns): Internal functions
Function, (setf or-pattern-subpatterns): Exported functions
Function, (setf pattern-expand-function): Exported functions
Function, (setf place-pattern-name): Exported functions
Function, (setf property-pattern-item): Exported functions
Function, (setf property-pattern-subpatterns): Internal functions
Function, (setf simple-vector-pattern-subpatterns): Exported functions
Function, (setf structure-pattern-conc-name): Exported functions
Function, (setf structure-pattern-slot-names): Exported functions
Function, (setf structure-pattern-subpatterns): Exported functions
Function, (setf variable-pattern-name): Exported functions
Function, (setf vector-pattern-subpatterns): Exported functions
Function, and-pattern-p: Internal functions
Function, and-pattern-subpatterns: Exported functions
Function, assoc-pattern-item: Exported functions
Function, assoc-pattern-key: Exported functions
Function, assoc-pattern-p: Internal functions
Function, assoc-pattern-subpatterns: Internal functions
Function, assoc-pattern-test: Exported functions
Function, assoc-pattern-value-pattern: Exported functions
Function, check-patterns: Exported functions
Function, class-pattern-class-name: Exported functions
Function, class-pattern-p: Internal functions
Function, class-pattern-slot-names: Exported functions
Function, class-pattern-subpatterns: Exported functions
Function, compile-clause-body: Internal functions
Function, compile-match: Internal functions
Function, compile-match-1: Internal functions
Function, compile-match-constant-group: Internal functions
Function, compile-match-constructor-group: Internal functions
Function, compile-match-empty-group: Internal functions
Function, compile-match-fail: Internal functions
Function, compile-match-group: Internal functions
Function, compile-match-groups: Internal functions
Function, compile-match-not-group: Internal functions
Function, compile-match-or-group: Internal functions
Function, compile-match-place-group: Internal functions
Function, compile-match-variable-group: Internal functions
Function, compile-multiple-value-match: Internal functions
Function, complex-pattern-p: Internal functions
Function, complex-pattern-subpatterns: Exported functions
Function, cons-pattern-car-pattern: Exported functions
Function, cons-pattern-cdr-pattern: Exported functions
Function, cons-pattern-p: Internal functions
Function, cons-pattern-subpatterns: Internal functions
Function, constant-pattern-p: Internal functions
Function, constant-pattern-value: Exported functions
Function, constructor-pattern-arity: Exported functions
Function, constructor-pattern-p: Internal functions
Function, constructor-pattern-subpatterns: Exported functions
Function, copy-and-pattern: Internal functions
Function, copy-assoc-pattern: Internal functions
Function, copy-class-pattern: Internal functions
Function, copy-complex-pattern: Internal functions
Function, copy-cons-pattern: Internal functions
Function, copy-constant-pattern: Internal functions
Function, copy-constructor-pattern: Internal functions
Function, copy-destructor: Internal functions
Function, copy-guard-pattern: Internal functions
Function, copy-not-pattern: Internal functions
Function, copy-or-pattern: Internal functions
Function, copy-pattern: Internal functions
Function, copy-place-pattern: Internal functions
Function, copy-property-pattern: Internal functions
Function, copy-simple-vector-pattern: Internal functions
Function, copy-structure-pattern: Internal functions
Function, copy-variable-pattern: Internal functions
Function, copy-vector-pattern: Internal functions
Function, destructor-accessor-forms: Exported functions
Function, destructor-bindings: Internal functions
Function, destructor-p: Internal functions
Function, destructor-predicate-form: Internal functions
Function, group: Internal functions
Function, group-match-clauses: Internal functions
Function, guard-pattern-p: Internal functions
Function, guard-pattern-subpattern: Exported functions
Function, guard-pattern-subpatterns: Internal functions
Function, guard-pattern-test-form: Exported functions
Function, lift-guard-patterns: Exported functions
Function, lift-guard-patterns-1: Internal functions
Function, lift-guard-patterns-2: Internal functions
Function, make-and-pattern: Exported functions
Function, make-assoc-pattern: Exported functions
Function, make-class-pattern: Exported functions
Function, make-complex-pattern: Internal functions
Function, make-cons-pattern: Exported functions
Function, make-constant-pattern: Exported functions
Function, make-constructor-pattern: Internal functions
Function, make-destructor: Exported functions
Function, make-guard-pattern: Exported functions
Function, make-not-pattern: Exported functions
Function, make-or-pattern: Exported functions
Function, make-pattern: Internal functions
Function, make-place-pattern: Exported functions
Function, make-property-pattern: Exported functions
Function, make-simple-vector-pattern: Exported functions
Function, make-structure-pattern: Exported functions
Function, make-variable-pattern: Exported functions
Function, make-vector-pattern: Exported functions
Function, not-pattern-p: Internal functions
Function, not-pattern-subpattern: Exported functions
Function, not-pattern-subpatterns: Internal functions
Function, or-pattern-p: Internal functions
Function, or-pattern-subpatterns: Exported functions
Function, parse-class-pattern: Internal functions
Function, parse-pattern: Exported functions
Function, parse-structure-pattern: Internal functions
Function, pattern-expand: Exported functions
Function, pattern-expand-1: Exported functions
Function, pattern-expand-all: Exported functions
Function, pattern-expand-function: Exported functions
Function, pattern-p: Internal functions
Function, pattern-variables: Exported functions
Function, place-pattern-included-p: Exported functions
Function, place-pattern-name: Exported functions
Function, place-pattern-p: Internal functions
Function, preprocess-match-clause: Internal functions
Function, preprocess-match-clauses: Internal functions
Function, property-pattern-item: Exported functions
Function, property-pattern-p: Internal functions
Function, property-pattern-subpatterns: Internal functions
Function, property-pattern-value-pattern: Exported functions
Function, self-evaluating-object-p: Internal functions
Function, set-equal: Internal functions
Function, simple-vector-pattern-p: Internal functions
Function, simple-vector-pattern-subpatterns: Exported functions
Function, span: Internal functions
Function, structure-pattern-conc-name: Exported functions
Function, structure-pattern-p: Internal functions
Function, structure-pattern-slot-names: Exported functions
Function, structure-pattern-subpatterns: Exported functions
Function, variable-pattern-name: Exported functions
Function, variable-pattern-p: Internal functions
Function, vector-pattern-p: Internal functions
Function, vector-pattern-subpatterns: Exported functions

G
Generic Function, constructor-pattern-destructor-sharable-p: Exported generic functions
Generic Function, constructor-pattern-make-destructor: Exported generic functions
Generic Function, match-error-patterns: Exported generic functions
Generic Function, match-error-values: Exported generic functions
Generic Function, parse-constructor-pattern: Exported generic functions
Generic Function, unparse-pattern: Exported generic functions
group: Internal functions
group-match-clauses: Internal functions
guard-pattern-p: Internal functions
guard-pattern-subpattern: Exported functions
guard-pattern-subpatterns: Internal functions
guard-pattern-test-form: Exported functions

I
if-match: Exported macros

L
lambda-cmatch: Exported macros
lambda-cmatch1: Exported macros
lambda-ematch: Exported macros
lambda-ematch1: Exported macros
lambda-match: Exported macros
lambda-match1: Exported macros
let-match: Exported macros
let-match*: Exported macros
let-match1: Exported macros
lift-guard-patterns: Exported functions
lift-guard-patterns-1: Internal functions
lift-guard-patterns-2: Internal functions

M
Macro, %equals: Exported macros
Macro, %if: Internal macros
Macro, %match: Internal macros
Macro, %or: Internal macros
Macro, cmatch: Exported macros
Macro, cmatch*: Internal macros
Macro, defpattern: Exported macros
Macro, ematch: Exported macros
Macro, ematch*: Internal macros
Macro, fail: Exported macros
Macro, if-match: Exported macros
Macro, lambda-cmatch: Exported macros
Macro, lambda-cmatch1: Exported macros
Macro, lambda-ematch: Exported macros
Macro, lambda-ematch1: Exported macros
Macro, lambda-match: Exported macros
Macro, lambda-match1: Exported macros
Macro, let-match: Exported macros
Macro, let-match*: Exported macros
Macro, let-match1: Exported macros
Macro, match: Exported macros
Macro, match*: Internal macros
Macro, multiple-value-cmatch: Exported macros
Macro, multiple-value-ematch: Exported macros
Macro, multiple-value-match: Exported macros
Macro, once-only*: Internal macros
Macro, unless-match: Exported macros
Macro, when-match: Exported macros
make-and-pattern: Exported functions
make-assoc-pattern: Exported functions
make-class-pattern: Exported functions
make-complex-pattern: Internal functions
make-cons-pattern: Exported functions
make-constant-pattern: Exported functions
make-constructor-pattern: Internal functions
make-destructor: Exported functions
make-guard-pattern: Exported functions
make-not-pattern: Exported functions
make-or-pattern: Exported functions
make-pattern: Internal functions
make-place-pattern: Exported functions
make-property-pattern: Exported functions
make-simple-vector-pattern: Exported functions
make-structure-pattern: Exported functions
make-variable-pattern: Exported functions
make-vector-pattern: Exported functions
match: Exported macros
match*: Internal macros
match-error-patterns: Exported generic functions
match-error-patterns: Exported generic functions
match-error-values: Exported generic functions
match-error-values: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-destructor-sharable-p: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, constructor-pattern-make-destructor: Exported generic functions
Method, match-error-patterns: Exported generic functions
Method, match-error-values: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, parse-constructor-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
Method, unparse-pattern: Exported generic functions
multiple-value-cmatch: Exported macros
multiple-value-ematch: Exported macros
multiple-value-match: Exported macros

N
not-pattern-p: Internal functions
not-pattern-subpattern: Exported functions
not-pattern-subpatterns: Internal functions

O
once-only*: Internal macros
or-pattern-p: Internal functions
or-pattern-subpatterns: Exported functions

P
parse-class-pattern: Internal functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-constructor-pattern: Exported generic functions
parse-pattern: Exported functions
parse-structure-pattern: Internal functions
pattern-expand: Exported functions
pattern-expand-1: Exported functions
pattern-expand-all: Exported functions
pattern-expand-function: Exported functions
pattern-p: Internal functions
pattern-variables: Exported functions
place-pattern-included-p: Exported functions
place-pattern-name: Exported functions
place-pattern-p: Internal functions
preprocess-match-clause: Internal functions
preprocess-match-clauses: Internal functions
property-pattern-item: Exported functions
property-pattern-p: Internal functions
property-pattern-subpatterns: Internal functions
property-pattern-value-pattern: Exported functions

S
self-evaluating-object-p: Internal functions
set-equal: Internal functions
simple-vector-pattern-p: Internal functions
simple-vector-pattern-subpatterns: Exported functions
span: Internal functions
structure-pattern-conc-name: Exported functions
structure-pattern-p: Internal functions
structure-pattern-slot-names: Exported functions
structure-pattern-subpatterns: Exported functions

U
unless-match: Exported macros
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions
unparse-pattern: Exported generic functions

V
variable-pattern-name: Exported functions
variable-pattern-p: Internal functions
vector-pattern-p: Internal functions
vector-pattern-subpatterns: Exported functions

W
when-match: Exported macros

Jump to:   %   (  
A   C   D   E   F   G   I   L   M   N   O   P   S   U   V   W  

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

A.3 Variables

Jump to:   %   *  
A   B   C   I   K   N   P   S   T   V  
Index Entry  Section

%
%fail: Internal symbol macros

*
*debug-compiler*: Internal special variables

A
accessor-forms: Exported structures

B
bindings: Exported structures

C
class-name: Exported structures
conc-name: Exported structures

I
item: Exported structures
item: Exported structures

K
key: Exported structures

N
name: Exported structures
name: Exported structures

P
patterns: Exported conditions
predicate-form: Exported structures

S
Slot, accessor-forms: Exported structures
Slot, bindings: Exported structures
Slot, class-name: Exported structures
Slot, conc-name: Exported structures
Slot, item: Exported structures
Slot, item: Exported structures
Slot, key: Exported structures
Slot, name: Exported structures
Slot, name: Exported structures
Slot, patterns: Exported conditions
Slot, predicate-form: Exported structures
Slot, slot-names: Exported structures
Slot, slot-names: Exported structures
Slot, subpatterns: Exported structures
Slot, test: Exported structures
Slot, test-form: Exported structures
Slot, value: Exported structures
Slot, values: Exported conditions
slot-names: Exported structures
slot-names: Exported structures
Special Variable, *debug-compiler*: Internal special variables
subpatterns: Exported structures
Symbol Macro, %fail: Internal symbol macros

T
test: Exported structures
test-form: Exported structures

V
value: Exported structures
values: Exported conditions

Jump to:   %   *  
A   B   C   I   K   N   P   S   T   V  

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

A.4 Data types

Jump to:   A   C   D   G   M   N   O   P   S   V  
Index Entry  Section

A
and-pattern: Exported structures
assoc-pattern: Exported structures

C
class-pattern: Exported structures
complex-pattern: Exported structures
Condition, match-error: Exported conditions
cons-pattern: Exported structures
constant-pattern: Exported structures
constructor-pattern: Exported structures

D
destructor: Exported structures

G
guard-pattern: Exported structures

M
match-error: Exported conditions

N
not-pattern: Exported structures

O
optima: The optima system
optima: The optima package
optima.core: The optima<dot>core package
optima.extra: The optima<dot>extra package
or-pattern: Exported structures

P
Package, optima: The optima package
Package, optima.core: The optima<dot>core package
Package, optima.extra: The optima<dot>extra package
pattern: Internal structures
place-pattern: Exported structures
property-pattern: Exported structures

S
simple-vector-pattern: Exported structures
Structure, and-pattern: Exported structures
Structure, assoc-pattern: Exported structures
Structure, class-pattern: Exported structures
Structure, complex-pattern: Exported structures
Structure, cons-pattern: Exported structures
Structure, constant-pattern: Exported structures
Structure, constructor-pattern: Exported structures
Structure, destructor: Exported structures
Structure, guard-pattern: Exported structures
Structure, not-pattern: Exported structures
Structure, or-pattern: Exported structures
Structure, pattern: Internal structures
Structure, place-pattern: Exported structures
Structure, property-pattern: Exported structures
Structure, simple-vector-pattern: Exported structures
Structure, structure-pattern: Exported structures
Structure, variable-pattern: Exported structures
Structure, vector-pattern: Exported structures
structure-pattern: Exported structures
System, optima: The optima system

V
variable-pattern: Exported structures
vector-pattern: Exported structures

Jump to:   A   C   D   G   M   N   O   P   S   V