Commit 6cf7690f authored by Vincent Zweije's avatar Vincent Zweije
Browse files

Removed redundancy (history graph) in result of function findoccs

parent b5f3f499
...@@ -82,18 +82,18 @@ actualfold deltanodes rnfnodes foldarea self foldcont hist rule ...@@ -82,18 +82,18 @@ actualfold deltanodes rnfnodes foldarea self foldcont hist rule
list2 = map (pairwith (findoccs hist rule)) (removeMembers (varlist rgraph [rroot]) (varlist rgraph rargs)) list2 = map (pairwith (findoccs hist rule)) (removeMembers (varlist rgraph [rroot]) (varlist rgraph rargs))
// list2: list combining every node with list of every instantiable history graph // list2: list combining every node with list of every instantiable history graph
list3 = [(rnode,hgraph,mapping) \\ (rnode,[((hroot,hgraph),mapping):_])<-list2] list3 = [(rnode,mapping) \\ (rnode,[mapping:_])<-list2]
// list3: list combining every instantiable node with first instantiable history graph // list3: list combining every instantiable node with first instantiable history graph
rgraph` rgraph`
= foldr foldrec rgraph list3 = foldr foldrec rgraph list3
where foldrec (rnode,hgraph,mapping) = updategraph rnode (mapsnd (map (lookup mapping)) foldcont) where foldrec (rnode,mapping) = updategraph rnode (mapsnd (map (lookup mapping)) foldcont)
(rgraph``,areas`) = finishfold foldarea fixednodes singlenodes rroot rgraph` (rgraph``,areas`) = finishfold foldarea fixednodes singlenodes rroot rgraph`
fixednodes = intersect (removeDup (argnodes++foldednodes++rnfnodes)) (varlist rgraph` [rroot]) fixednodes = intersect (removeDup (argnodes++foldednodes++rnfnodes)) (varlist rgraph` [rroot])
singlenodes = intersect deltanodes (varlist rgraph` [rroot]) singlenodes = intersect deltanodes (varlist rgraph` [rroot])
argnodes = varlist rgraph` rargs argnodes = varlist rgraph` rargs
foldednodes = map fst3 list3 foldednodes = map fst list3
/* /*
> findoccs > findoccs
...@@ -125,12 +125,12 @@ findoccs :: ...@@ -125,12 +125,12 @@ findoccs ::
[(pvar,Graph sym pvar)] [(pvar,Graph sym pvar)]
(Rule sym var) (Rule sym var)
var var
-> [((pvar,Graph sym pvar),[(pvar,var)])] -> [[(pvar,var)]]
| == var | == var
& == pvar & == pvar
findoccs hist rule rnode findoccs hist rule rnode
= [ ((hroot,hgraph),mapping) = [ mapping
\\ ((hroot,hgraph),(seen,mapping,[]))<-list1 // Find instantiable history rgraphs... \\ ((hroot,hgraph),(seen,mapping,[]))<-list1 // Find instantiable history rgraphs...
| unshared rnode (hroot,hgraph) mapping // ...which don't have shared contents | unshared rnode (hroot,hgraph) mapping // ...which don't have shared contents
] ]
......
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