-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.curry
53 lines (35 loc) · 1.45 KB
/
test.curry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import SetFunctions (foldValues, mapValues, set0, set3, Values, select)
import ValueSequence (addVS, emptyVS,vsToList, ValueSequence)
import SearchTree (dfsStrategy, someSearchTree, searchTreeSize, SearchTree(..))
bools = foldr (:) [] (replicate 1000000 True)
and :: Bool
and = foldr (&&) True (replicate 10000000 True)
andV :: Bool
andV = foldValues (&&) True (set0 (foldr (?) True (replicate 10000000 True)))
one = fst (select set0VerySmall)
mapV = mapValues (|| False) set0VerySmall
mapNormal = map (|| False) (replicate 1000000 True)
andVSmall :: Bool
andVSmall = foldValues (&&) True set0VerySmall
set0VerySmall :: Values Bool
set0VerySmall = set0 (foldr1 (?) (replicate 4 True))
set0Small :: Values Bool
set0Small = set0 (foldr (?) True (replicate 100000 True))
set3Small :: Values Bool
set3Small = set3 foldr (?) True (replicate 100000 True)
valueSeqs :: ValueSequence Bool
valueSeqs = foldr addVS emptyVS (replicate 1000000 True)
seqToList :: [Bool]
seqToList = vsToList valueSeqs
seqToBool = foldr (&&) True seqToList
sTree = someSearchTree (foldr (?) True (replicate 1000 True))
foldTree :: (a -> b) -> (b -> b -> b) -> b -> SearchTree a -> b
foldTree _ _ e (Fail _) = e
foldTree f g _ (Value x) = f x
foldTree f g e (Or t1 t2) = g e (foldTree f g (foldTree f g e t1) t2)
strategy = dfsStrategy sTree
size = searchTreeSize sTree
andT = foldr (&&) True (vsToList strategy)
inefficient | gen = 1
where
gen = foldr (?) True (replicate 100000000 False)