aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzweije2001-08-13 15:46:11 +0000
committerzweije2001-08-13 15:46:11 +0000
commitdcf025ce426fa0239f16730551cc95b4cf048a11 (patch)
treea613fa278aed97320d4b54986efd5ba5bb4607fc
parentThis commit was generated by cvs2svn to compensate for changes in r616, (diff)
This commit was generated by cvs2svn to compensate for changes in r618,
which included commits to RCS files with non-trunk default branches. git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@619 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--sucl/graph.dcl3
-rw-r--r--sucl/graph.icl23
2 files changed, 12 insertions, 14 deletions
diff --git a/sucl/graph.dcl b/sucl/graph.dcl
index 1ed9c29..eef57a7 100644
--- a/sucl/graph.dcl
+++ b/sucl/graph.dcl
@@ -2,6 +2,7 @@ definition module graph
// $Id$
+from pfun import Pfun
from StdOverloaded import ==
// A rule associating a replacement with a pattern
@@ -214,4 +215,6 @@ compilegraph :: ![(var,Node sym var)] -> Graph sym var
*/
+extgraph :: (Graph sym var) (Graph sym pvar) [pvar] (Pfun pvar var) (Graph sym var) -> Graph sym var | == var & == pvar
+
instance == (Graph sym var) | == sym & == var
diff --git a/sucl/graph.icl b/sucl/graph.icl
index 40d153e..8812b9a 100644
--- a/sucl/graph.icl
+++ b/sucl/graph.icl
@@ -359,22 +359,17 @@ Uses in Miranda:
`Extgraph' is excluded in most import statements,
but there doesn't seem to be any other definition of it.
-
-> extgraph :: graph * ** -> graph * *** -> [***] -> pfun *** ** -> graph * ** -> graph * **
-> extgraph sgraph pattern pnodes matching graph
-> = foldr addnode graph pnodes
-> where addnode pnode
-> = total id (postcomp addnode' matching) pnode, if fst (nodecontents pattern pnode)
-> = id, otherwise
-> addnode' snode
-> = updategraph snode scont, if sdef
-> = id, otherwise
->|| = error "extgraph: closed node mapped to open node", otherwise
-> || Could have used id, but let's report error when there is one...
-> where (sdef,scont) = nodecontents sgraph snode
-
*/
+extgraph :: (Graph sym var) (Graph sym pvar) [pvar] (Pfun pvar var) (Graph sym var) -> Graph sym var | == var & == pvar
+extgraph sgraph pattern pnodes matching graph
+= foldr addnode graph pnodes
+ where addnode pnode
+ = if (fst (varcontents pattern pnode)) (total id (postcomp addnode` matching) pnode) id
+ addnode` snode
+ = if sdef (updategraph snode scont) id
+ where (sdef,scont) = varcontents sgraph snode
+
mapgraph ::
!( (Pfun var1 (sym1,[var1]))
-> Pfun .var2 (.sym2,[.var2])