summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Wisniowski <matthias.wisniowski@gmail.com>2012-05-30 00:12:10 +0200
committerMatthias Wisniowski <matthias.wisniowski@gmail.com>2012-05-30 00:12:10 +0200
commit78a4651eca476bbba1d916140f0054c49a02f980 (patch)
treeb80f396e7c3b8ac2244d133a7ae3c2fcf6135156
parentbf712038d85069afcc8bc063f40caca466ca81b6 (diff)
parent46e188c83e0ca7456420f4010b5b7b0422dc6acd (diff)
downloadffp-78a4651eca476bbba1d916140f0054c49a02f980.tar.gz
ffp-78a4651eca476bbba1d916140f0054c49a02f980.tar.bz2
ffp-78a4651eca476bbba1d916140f0054c49a02f980.zip
Merge branch 'master' of ssh://git.manuel.mausz.at:2211/ffp
Conflicts: AufgabeFFP8.hs
-rw-r--r--AufgabeFFP8.hs42
1 files changed, 42 insertions, 0 deletions
diff --git a/AufgabeFFP8.hs b/AufgabeFFP8.hs
index 2747597..436e6cb 100644
--- a/AufgabeFFP8.hs
+++ b/AufgabeFFP8.hs
@@ -115,5 +115,47 @@ minfree_bhof xs = head $ divideAndConquer (b_indiv (length xs)) b_solve (b_divid
115 where b = 1+(length xs) `div` 2 115 where b = 1+(length xs) `div` 2
116 116
117-- minfree refined daq higher order 117-- minfree refined daq higher order
118
118 119
120-- refined divide-and-conquer mittels higher order function
121--minfree_rhof :: [Int] -> Int
122--minfree_rhof = divideAndConquer r_indiv r_solve r_divide r_combine
123--
124--r_indiv :: (Int, [Int]) -> Bool
125--r_indiv (a, xs)
119 126
127-- optimised divide-and-conquer mittels higher order function
128--minfree_ohof :: [Int] -> Int
129
130
131
132-- QuickCheck part
133
134functions = [ minfree_bv, minfree_chl, minfree_col,
135 minfree_b, minfree_r, minfree_o,
136 minfree_bhof]
137
138-- calc values of all function
139calc_all :: [Int] -> [Int]
140calc_all xs = [ f xs | f <- functions ]
141
142-- check if all values of a list are the same
143all_eq :: [Int] -> Bool
144all_eq (x:[]) = True
145all_eq (x:y:xs)
146 | x == y = all_eq (y:xs)
147 | otherwise = False
148
149-- check if a list contains no duplicates
150--no_dups :: [Int] -> Bool
151--no_dups [] = True
152--no_dups (x:xs)
153-- | x `elem` xs = False
154-- | otherwise = no_dups xs
155
156prop_allImplsEq_a :: [Int] -> Bool
157prop_allImplsEq_a xs = all_eq $ calc_all (nub xs)
158
159-- keine negativen listenelemented durch vorbedingung entfernt
160prop_allImplsEq_b :: [Int] -> Property
161prop_allImplsEq_b xs = all (>=0) xs ==> all_eq $ calc_all (nub xs) \ No newline at end of file