Commit 81d71ebb authored by Vincent Zweije's avatar Vincent Zweije
Browse files

This commit was generated by cvs2svn to compensate for changes in r534,

which included commits to RCS files with non-trunk default branches.
parent 1a65275c
......@@ -14,6 +14,7 @@ Basic types and functions.
*/
from general import Optional
import StdOverloaded
import StdString
......@@ -26,7 +27,8 @@ Implementation
// The optional type of type t is a type like t
// where the actual t value may be present or absent.
:: Optional t = Absent | Present t
//:: Optional t = Absent | Present t
//Now using Optional from cocl's general module
// Adjust a function for a single argument
......
......@@ -23,7 +23,9 @@ Implementation
*/
:: Optional t = Absent | Present t
//:: Optional t = Absent | Present t
// Now using Optional type from cocl's general module
from general import Optional,No,Yes
// Adjust a function for a single argument
......@@ -91,8 +93,8 @@ foldmap f d
where foldmap` (x,y) g v = if (x==v) (f y) (g v)
foldoptional :: .res .(.t -> .res) !(Optional .t) -> .res
foldoptional absent present Absent = absent
foldoptional absent present (Present x) = present x
foldoptional no yes No = no
foldoptional no yes (Yes x) = yes x
forget :: val -> .(![.(val,res)] -> .[(val,res)]) | == val
forget x = filter (neq x o fst)
......@@ -161,8 +163,8 @@ power n f
= f o power (n-1) f
printoptional :: .(.t -> String) !(Optional .t) -> String
printoptional printa Absent = ""
printoptional printa (Present a) = printa a
printoptional printa No = ""
printoptional printa (Yes a) = printa a
proc :: .((w:elem -> .(.res -> .res)) -> v:(![w:elem] -> u:(.res -> .res))), [u <= v, u <= w]
proc = flip o foldr
......@@ -178,8 +180,8 @@ maphd f [] = []
maphd f [x:xs] = [f x:xs]
mapoptional :: .(.a -> .b) !(Optional .a) -> Optional .b
mapoptional f Absent = Absent
mapoptional f (Present x) = Present (f x)
mapoptional f No = No
mapoptional f (Yes x) = Yes (f x)
mappair :: .(.a -> .b) .(.c -> .d) !(.a,.c) -> (.b,.d)
mappair f g (x,y) = (f x,g y)
......@@ -219,8 +221,8 @@ showbool :: .(!.Bool -> a) | fromBool a
showbool = fromBool
showoptional :: .(.a -> .String) !(Optional .a) -> String
showoptional showa Absent = "Absent"
showoptional showa (Present a) = "(Present "+++showa a+++")"
showoptional showa No = "No"
showoptional showa (Yes a) = "(Yes "+++showa a+++")"
showpair :: !.(.a -> .String) !.(.b -> .String) !(.a,.b) -> String
showpair showa showb (a,b) = "("+++showa a+++","+++showb b+++")"
......
......@@ -11,6 +11,7 @@ import rule
import graph
import pfun
import basic
from general import Yes,No
import StdEnv
/*
......@@ -134,14 +135,14 @@ transform
| == var
& == pvar
transform anode sargs (Present spine)
transform anode sargs (Yes spine)
= selectfromtip (spinetip spine)
where selectfromtip (nid,Open rgraph) = tryinstantiate nid rgraph anode sargs
selectfromtip (nid,Redex rule matching) = tryunfold nid rule matching spine
selectfromtip (nid,Strict) = tryannotate nid sargs
selectfromtip spine = dostop
transform anode sargs Absent
transform anode sargs No
= dostop
// ==== ATTEMPT TO INSTANTIATE A FREE VARIABLE WITH A PATTERN ====
......
......@@ -4,7 +4,7 @@ definition module spine
from rule import Rgraph,Rule
from pfun import Pfun
from basic import Optional
from general import Optional
/*
......
......@@ -9,6 +9,7 @@ import rule
import graph
import pfun
import basic
from general import No,Yes
import StdEnv
/*
......@@ -110,8 +111,8 @@ makernfstrategy
makernfstrategy hist strat rnfnodes node graph
= substrat [] spinecont rnfanswer node
where spinecont spine = Present spine
rnfanswer = Absent
where spinecont spine = Yes spine
rnfanswer = No
substrat spinenodes spinecont rnfanswer node
| isMember node spinenodes
......
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