summaryrefslogtreecommitdiffstats
path: root/AufgabeFFP6.hs
diff options
context:
space:
mode:
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