Commit db20db1e authored by Vincent Zweije's avatar Vincent Zweije
Browse files

Associate history patterns with node-ids, not links

parent 899633cf
...@@ -17,7 +17,7 @@ from spine import Subspine ...@@ -17,7 +17,7 @@ from spine import Subspine
// An association between a node-id in the subject graph and a history pattern // An association between a node-id in the subject graph and a history pattern
:: HistoryAssociation sym var :: HistoryAssociation sym var
:== ( (Link var) // Attachment point in the subject graph where the history pattern is "housed" :== ( var // Attachment point in the subject graph where the history pattern is "housed"
, HistoryPattern sym var // The pattern in the history , HistoryPattern sym var // The pattern in the history
) )
...@@ -40,11 +40,11 @@ extendhistory ...@@ -40,11 +40,11 @@ extendhistory
& == pvar & == pvar
// Check the current subject graph in the history // Check the current subject graph in the history
checkhistory matchhistory
:: (History sym var) :: (History sym var) // Complete history against which to check
[Link var] [var] // Node-ids for which to include history patterns
(Graph sym var) (Graph sym var) // Current subject graph
var var // Current application point of strategy
-> [HistoryPattern sym var] -> [HistoryPattern sym var] // Matching history patterns
| == sym | == sym
& == var & == var
...@@ -16,7 +16,7 @@ import StdEnv ...@@ -16,7 +16,7 @@ import StdEnv
// An association between a node-id in the subject graph and a history pattern // An association between a node-id in the subject graph and a history pattern
:: HistoryAssociation sym var :: HistoryAssociation sym var
:== ( (Link var) // Attachment point in the subject graph where the history pattern is "housed" :== ( var // Attachment point in the subject graph where the history pattern is "housed"
, HistoryPattern sym var // The pattern in the history , HistoryPattern sym var // The pattern in the history
) )
...@@ -143,10 +143,10 @@ extendopen ...@@ -143,10 +143,10 @@ extendopen
) )
| == var | == var
extendopen _ _ link extender0 extendopen _ snode link extender0
= (newpattern,histpat,extender1) = (newpattern,histpat,extender1)
where histpat = OpenHist where histpat = OpenHist
newpattern = (link,histpat) newpattern = (snode,histpat)
extender1 = adjust link histpat extender0 extender1 = adjust link histpat extender0
extendpartial extendpartial
...@@ -228,7 +228,7 @@ extendfunction sgraph rule matching issub extendsub snode link extender0 ...@@ -228,7 +228,7 @@ extendfunction sgraph rule matching issub extendsub snode link extender0
(sdef,(ssym,_)) = varcontents sgraph snode (sdef,(ssym,_)) = varcontents sgraph snode
rgraph = rulegraph rule rgraph = rulegraph rule
rargs = arguments rule rargs = arguments rule
thisnewpattern = (link,thispat) thisnewpattern = (snode,thispat)
extendnodes extendnodes
:: (Graph sym var) // Subject graph :: (Graph sym var) // Subject graph
...@@ -309,20 +309,20 @@ extendnode sgraph rgraph matching issub extendsub (link,rnode) (newpattern0,rest ...@@ -309,20 +309,20 @@ extendnode sgraph rgraph matching issub extendsub (link,rnode) (newpattern0,rest
* Verifying a subject graph against the history * * Verifying a subject graph against the history *
************************************************/ ************************************************/
checkhistory matchhistory
:: (History sym var) :: (History sym var) // Complete history against which to check
[Link var] [var] // Node-ids for which to include history patterns
(Graph sym var) (Graph sym var) // Current subject graph
var var // Current application point of strategy
-> [HistoryPattern sym var] -> [HistoryPattern sym var] // Matching history patterns
| == sym | == sym
& == var & == var
checkhistory hist spinelinks sgraph snode matchhistory hist spinenodes sgraph snode
= foldr (checkassoc spinelinks sgraph snode) [] hist = foldr (checkassoc spinenodes sgraph snode) [] hist
checkassoc spinelinks sgraph snode (link,pat) rest checkassoc spinenodes sgraph snode (var,pat) rest
| isMember link spinelinks && checkpat sgraph pat snode | isMember var spinenodes && checkpat sgraph pat snode
= [pat:rest] = [pat:rest]
= rest = rest
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment