Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cl-unification
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
cl-unification
cl-unification
Commits
35747994
Commit
35747994
authored
Jul 19, 2016
by
Marco Antoniotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified documentation strings.
parent
48248b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
31 deletions
+57
-31
match-block.lisp
match-block.lisp
+57
-31
No files found.
match-block.lisp
View file @
35747994
...
...
@@ -137,7 +137,12 @@ is set up around the matching code.
(
define-condition
unification-non-exhaustive
(
unification-failure
)
())
()
(
:documentation
"Condition thrown by 'match' forms.
The condition UNIFICATION-FAILURE is thrown by 'match' forms when it
can be established that there are other possible unifications for a
template."
))
(
defmacro
matching
((
&key
errorp
...
...
@@ -147,19 +152,21 @@ is set up around the matching code.
&rest
match-clauses
)
"MATCHING sets up a COND-like environment for multiple template matching clauses.
The syntax of MATCHING comprises a number of clauses of the form
<clause> ::= <regular-clause> | <default-clause>
<regular-clause> ::= ((<template> <form>) &body <forms>)
<default-clause> ::= (t &body <forms>)
| (otherwise &body <forms>)
<form> and <forms> are regular Common Lisp forms.
<template> is a unification template.
The syntax of MATCHING comprises a number of clauses, collected in
MATCH-CLAUSES, of the form
<pre>
clause ::= regular-clause | default-clause
regular-clause ::= '(' '(' template form ')' '&body' forms ')'
default-clause ::= '(' 't' '&body' forms ')'
| '(' 'otherwise' '&body' forms ')'
</pre>
'form' and 'forms' are regular Common Lisp forms.
'template' is a unification template.
The full syntax of MATCHING is
matching (&key errorp default-substitution)
<clauses>
<pre>
matching (&key errorp default-substitution)
clauses
</pre>
Each clause evaluates its forms in an environment where the variables
present in the template are bound lexically. Note that both variable
names '?FOO' and 'FOO' are bound for convenience.
...
...
@@ -171,6 +178,11 @@ If ERRORP is non-NIL then if none of the regular clauses matches, then
an error of type UNIFICATION-NON-EXAUSTIVE is signalled, regardless of
any default clause. Otherwise, the default clause behaves as a
standard COND default clause. The default value of ERRORP is NIL.
MATCHING-NAMED is used as BLOCK name around the MATCHING machinery.
DEFAULT-SUBSTITUTION is the substitution to be used for the matching;
it defaults to the empty substitution.
"
(
declare
(
ignore
default-substitution
))
; For the time being.
(
labels
((
%%match%%
(
clause-var
template
object
forms
substitution
)
...
...
@@ -253,18 +265,19 @@ standard COND default clause. The default value of ERRORP is NIL.
"MATCH-CASE sets up a CASE-like environment for multiple template matching clauses.
The syntax of MATCH-CASE comprises a number of clauses of the form
<clause> ::= <regular-clause> | <default-clause>
<regular-clause> ::= (<template> &body <forms>)
<default-clause> ::= (t &body <forms>)
| (otherwise &body <forms>)
<form> and <forms> are regular Common Lisp forms.
<template> is a unification template.
<pre>
clause ::= regular-clause | default-clause
regular-clause ::= '(' template '&body' forms ')'
default-clause ::= '(' t '&body' forms ')'
| '(' 'otherwise' '&body' forms ')'
</pre>
'form' and 'forms' are regular Common Lisp forms.
'template' is a unification template.
The full syntax of MATCH-CASE is
match-case (
<object> &key errorp default-substitution) <clauses>
<pre>
match-case (
object &key errorp default-substitution) clauses
</pre>
Each clause evaluates its forms in an environment where the variables
present in the template are bound lexically. Note that both variable
names '?FOO' and 'FOO' are bound for convenience.
...
...
@@ -276,6 +289,11 @@ If ERRORP is non-NIL then if none of the regular clauses matches, then
an error of type UNIFICATION-NON-EXAUSTIVE is signalled, regardless of
any default clause. Otherwise, the default clause behaves as a
standard CASE default clause. The default value of ERRORP is NIL.
MATCHING-NAMED is used as BLOCK name around the MATCHING machinery.
DEFAULT-SUBSTITUTION is the substitution to be used for the matching;
it defaults to the empty substitution.
"
(
declare
(
ignore
default-substitution
))
; For the time being.
(
let*
((
object-var
(
gensym
"OBJECT-VAR-"
))
...
...
@@ -311,17 +329,18 @@ standard CASE default clause. The default value of ERRORP is NIL.
"MATCHF-CASE sets up a CASE-like environment for multiple template matching clauses.
The syntax of MATCHF-CASE comprises a number of clauses of the form
<clause> ::= <regular-clause> | <default-clause>
<regular-clause> ::= (<template> &body <forms>)
<default-clause> ::= (t &body <forms>)
| (otherwise &body <forms>)
<form> and <forms> are regular Common Lisp forms.
<template> is a unification template.
<pre>
clause ::= regular-clause | default-clause
regular-clause ::= '(' template '&body' forms ')'
default-clause ::= '(' t '&body' forms ')'
| '(' 'otherwise' '&body' forms ')'
</pre>
'form' and 'forms' are regular Common Lisp forms.
'template' is a unification template.
The full syntax of MATCHF-CASE is
matchf-case (
<object> &key errorp default-substitution) <clauses>
matchf-case (
object &key errorp default-substitution) clauses
Each clause evaluates its forms in an environment where the variables
present in the template are bound lexically. Note that both variable
...
...
@@ -335,8 +354,15 @@ an error of type UNIFICATION-NON-EXAUSTIVE is signalled, regardless of
any default clause. Otherwise, the default clause behaves as a
standard CASE default clause. The default value of ERRORP is NIL.
MATCHING-NAMED is used as BLOCK name around the MATCHING machinery.
DEFAULT-SUBSTITUTION is the substitution to be used for the matching;
it defaults to the empty substitution.
Notes:
MATCHF-CASE behaves like MATCH-CASE, but the patterns are not
evaluated
(
i.e., it relies on MATCHF instead of MATCH to construct the
evaluated
;
i.e., it relies on MATCHF instead of MATCH to construct the
macro expansion.
"
(
declare
(
ignore
default-substitution
))
; For the time being.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment