aboutsummaryrefslogtreecommitdiff
path: root/frontend/utilities.icl
diff options
context:
space:
mode:
authormartinw2000-11-01 15:42:13 +0000
committermartinw2000-11-01 15:42:13 +0000
commit82bd65297bb04bdd2b144e2c426b6a548024ff6e (patch)
tree84d139b61c5b908fc66df5af7027f215814b0c87 /frontend/utilities.icl
parentchanges were necessary due to different numberings due to caching of dcl (diff)
improved code for explicit imports,
moved all switches to syntax module git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@277 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/utilities.icl')
-rw-r--r--frontend/utilities.icl32
1 files changed, 32 insertions, 0 deletions
diff --git a/frontend/utilities.icl b/frontend/utilities.icl
index 39f9a62..51f2c9d 100644
--- a/frontend/utilities.icl
+++ b/frontend/utilities.icl
@@ -205,6 +205,38 @@ iterateSt op st :== iterate_st op st
= iterate_st op st
= st
+mapFilterYesSt f l st
+ :== map_filter_yes_st l st
+ where
+ map_filter_yes_st [] st
+ = ([], st)
+ map_filter_yes_st [h:t] st
+ #! (opt_f_h , st) = f h st
+ (t2, st) = map_filter_yes_st t st
+ f_h_t2 = optCons opt_f_h t2
+ st = st
+ = (f_h_t2, st)
+
+
+iMapFilterYesSt f fr to st
+ :== i_map_filter_yes_st fr to st
+ where
+ i_map_filter_yes_st fr to st
+ | fr >= to
+ = ([], st)
+ #! (opt_f_fr, st) = f fr st
+ (t, st) = i_map_filter_yes_st (inc fr) to st
+ f_fr_t2 = optCons opt_f_fr t
+ st = st
+ = (f_fr_t2, st)
+
+optCons :: !(Optional .a) !u:[.a] -> v:[.a] ,[u <= v]
+optCons No l
+ = l
+optCons (Yes x) l
+ = [x:l]
+
+
eqMerge :: ![a] ![a] -> [a] | Eq a
eqMerge [a : x] y
| isMember a y