summaryrefslogtreecommitdiffstats
path: root/AufgabeFFP6.hs
diff options
context:
space:
mode:
authortotycro <totycro@unknown-horizons.org>2012-05-15 03:38:48 +0200
committertotycro <totycro@unknown-horizons.org>2012-05-15 03:38:48 +0200
commitaa0d10e643990b240b3e50b4beca056c642289b0 (patch)
treeb20eec1f00a80ccf84ce479ab6675890f2d8eb01 /AufgabeFFP6.hs
parentec1324e77472f183f8f3b3ab7add1b60b4f3e008 (diff)
downloadffp-aa0d10e643990b240b3e50b4beca056c642289b0.tar.gz
ffp-aa0d10e643990b240b3e50b4beca056c642289b0.tar.bz2
ffp-aa0d10e643990b240b3e50b4beca056c642289b0.zip
Aus unerfindlichen GrĂ¼nden liefert yield_gtf korrekte Ergebnisse
Diffstat (limited to 'AufgabeFFP6.hs')
-rw-r--r--AufgabeFFP6.hs12
1 files changed, 3 insertions, 9 deletions
diff --git a/AufgabeFFP6.hs b/AufgabeFFP6.hs
index c016dd7..1fde756 100644
--- a/AufgabeFFP6.hs
+++ b/AufgabeFFP6.hs
@@ -92,22 +92,16 @@ yield_gtf :: F -> W -> [G]
92yield_gtf = filt . transform . generate 92yield_gtf = filt . transform . generate
93 93
94generate :: F -> W -> (F, W, [G]) 94generate :: F -> W -> (F, W, [G])
95--generate f w = (f, w, [ array (1,n) [ (i, j) | i<-[1..n], j<-[(+), (-), (*)] ] ] ) 95generate f w = (f, w, [ array (1,n) entries | entries <- get_combinations n ] )
96generate f w = (f, w, [ array (1,n) [(i, j) | i<-[1..n], j<-[(+)] ] ] )
97 where 96 where
98 n = snd $ bounds f 97 n = (snd $ bounds f) - 1
99 98
100get_combinations :: Integer -> [[(Integer, Op)]] 99get_combinations :: Int -> [[(Int, Op)]]
101get_combinations 1 = [[(1,(+))], [(1, (-))], [(1, (*))], [(1,(./.))]] 100get_combinations 1 = [[(1,(+))], [(1, (-))], [(1, (*))], [(1,(./.))]]
102get_combinations n = [ (up i) ++ entr | entr <- get_combinations (n-1), i <- get_combinations 1 ] 101get_combinations n = [ (up i) ++ entr | entr <- get_combinations (n-1), i <- get_combinations 1 ]
103 where 102 where
104 up = map (\(num, x) -> ((num+n-1), x)) 103 up = map (\(num, x) -> ((num+n-1), x))
105 104
106--aget_combinations :: Integer -> [[Op]]
107--aget_combinations 1 = [[(+)], [(-)], [(*)], [(./.)]]
108--aget_combinations n = [ i ++ entr | entr <- aget_combinations (n-1), i <- aget_combinations 1 ]
109
110
111transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W]) 105transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W])
112transform fun w = ((f, w, g), map (eval f) g ) 106transform fun w = ((f, w, g), map (eval f) g )
113 where 107 where