Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Ioanna M. Dimitriou H.
jeffrey
Commits
07b43ec0
Commit
07b43ec0
authored
Feb 17, 2017
by
ioa
Browse files
Added documentation
parent
488a6d8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
graph.lisp
graph.lisp
+56
-0
No files found.
graph.lisp
View file @
07b43ec0
...
...
@@ -15,8 +15,25 @@
(
attributes
))
(
defun
make-node
(
name
LaTeX-statement
references
)
"*Arguments and values:
_name_-an integer name to be used as a key in the hash table stored in
{*graph*}.
_LaTeX-statement_-A string in LaTeX format, which is the full mathematical
statement of the axiom stored in {node}.
_references_-A string in LaTeX format, which contains references to where
this axiom was studied.
*Description:*
{make-node} creates a {node} structure with only the slots {name}, {LaTeX},
and {references}. This function type checks these slots. It is used in
{read.lisp} to store the axiom information, which is parsed from a TeX file."
(
check-type
name
integer
)
(
check-type
LaTeX-statement
string
)
(
check-type
references
string
)
(
make-node%
:name
name
:LaTeX
LaTeX-statement
:references
references
))
(
defstruct
(
edge
(
:constructor
make-edge%
))
...
...
@@ -25,11 +42,39 @@
(
attributes
))
(
defun
make-edge
(
destination
relation
)
"*Arguments and values:*
_destination_-a {node}
_relation_-{T} for 'implies', or {NIL} for 'does not imply'.
*Description:*
{make-edge} creates an {edge} structure with the slots ({destination}
and {relation}) filled, after type checking the content of the slots.
These edges are stored in the origin node as follows.
If we know that a node A implies a node B, then we add an edge E in its
{node-edges} list, where E has relation {T} and destination {B}.
If we know that a node A does not imply a node B, then we add an edge E in
its {node-edges} list, where E has relation {NIL} and destination {B}."
(
check-type
destination
node
)
(
check-type
relation
(
member
t
nil
))
(
make-edge%
:destination
destination
:relation
relation
))
(
defun
add-edge
(
node
edge
)
"*Arguments and values:*
_node_-a node
_edge_-an edge
*Description:*
Adds _edge_ to the list {(node-edges _node_)}, after type checking _edge_,
and after asserting that this edge is not already in the list, and that
{(edge-destination _edge_)} is not a parent of _node_."
(
check-type
edge
edge
)
(
assert
(
not
(
member
edge
#1=
(
node-edges
node
)))
()
"EDGE ~a is already an edge of NODE ~a."
edge
node
)
...
...
@@ -41,6 +86,17 @@
(
push
edge
#1#
))
(
defun
add-parent
(
node
parent
)
"*Arguments and values:*
_node_-a node
_parent_-a node
*Description:*
After type checking the arguments, it asserts that _parent_ is not already
in {(node-parents _node_)} and that _parent_ is not equal to _node_.
Then it pushes _parent_ to the list {(node-parents _node_)}."
(
check-type
parent
node
)
(
check-type
node
node
)
(
assert
(
not
(
member
parent
#1=
(
node-parents
node
)))
(
parent
)
...
...
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