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

Move inccounter function to basic module

parent 2a0b3c13
...@@ -82,6 +82,9 @@ indent :: .String -> .([.String] -> .[String]) ...@@ -82,6 +82,9 @@ indent :: .String -> .([.String] -> .[String])
// `Identifiers' is the list of all identifiers // `Identifiers' is the list of all identifiers
identifiers :: [String] identifiers :: [String]
// `Inccounter m f' increments counting function f by one at point m.
inccounter :: a (a->b) a -> b | == a & +,one b
// `Intersect xs ys' is the intersection of list `ys' with list `xs'. // `Intersect xs ys' is the intersection of list `ys' with list `xs'.
intersect :: ![elem] [elem] -> .[elem] | == elem intersect :: ![elem] [elem] -> .[elem] | == elem
......
...@@ -109,6 +109,9 @@ forget :: val -> .(![.(val,res)] -> .[(val,res)]) | == val ...@@ -109,6 +109,9 @@ forget :: val -> .(![.(val,res)] -> .[(val,res)]) | == val
forget x = filter (neq x o fst) forget x = filter (neq x o fst)
neq x y = x <> y neq x y = x <> y
inccounter :: a (a->b) a -> b | == a & +,one b
inccounter m f n = if (n==m) (f n+one) (f n)
indent :: .String -> .([.String] -> .[String]) indent :: .String -> .([.String] -> .[String])
indent first = map2 (+++) [first:repeat (createArray (size first) ' ')] indent first = map2 (+++) [first:repeat (createArray (size first) ' ')]
......
...@@ -178,8 +178,6 @@ refcount graph roots ...@@ -178,8 +178,6 @@ refcount graph roots
where count` = inccounter var count where count` = inccounter var count
(def,(_,args)) = varcontents graph var (def,(_,args)) = varcontents graph var
inccounter m f n = if (n==m) (f n+1) (f n)
/* /*
Compilegraph compiles a graph from parts. Compilegraph compiles a graph from parts.
......
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