summaryrefslogtreecommitdiffstats
path: root/AufgabeFFP6.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AufgabeFFP6.hs')
-rw-r--r--AufgabeFFP6.hs28
1 files changed, 13 insertions, 15 deletions
diff --git a/AufgabeFFP6.hs b/AufgabeFFP6.hs
index 73e5d62..c016dd7 100644
--- a/AufgabeFFP6.hs
+++ b/AufgabeFFP6.hs
@@ -96,13 +96,22 @@ generate :: F -> W -> (F, W, [G])
96generate f w = (f, w, [ array (1,n) [(i, j) | i<-[1..n], j<-[(+)] ] ] ) 96generate f w = (f, w, [ array (1,n) [(i, j) | i<-[1..n], j<-[(+)] ] ] )
97 where 97 where
98 n = snd $ bounds f 98 n = snd $ bounds f
99 --ops = [(+), (-), (*), (./.)] 99
100 --entries = [ (i, j) | i<-[1..3] , j<-ops ] 100get_combinations :: Integer -> [[(Integer, Op)]]
101get_combinations 1 = [[(1,(+))], [(1, (-))], [(1, (*))], [(1,(./.))]]
102get_combinations n = [ (up i) ++ entr | entr <- get_combinations (n-1), i <- get_combinations 1 ]
103 where
104 up = map (\(num, x) -> ((num+n-1), x))
105
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
101 110
102transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W]) 111transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W])
103transform fun = fun2 112transform fun w = ((f, w, g), map (eval f) g )
104 where 113 where
105 fun2 = \w -> (fun w, [1]) 114 (f, w, g) = fun w
106 115
107filt :: (W -> ((F,W,[G]),[W]) ) -> W -> [G] 116filt :: (W -> ((F,W,[G]),[W]) ) -> W -> [G]
108filt fun w = [ g!!i | i <- [0..n], res!!i == w ] 117filt fun w = [ g!!i | i <- [0..n], res!!i == w ]
@@ -110,17 +119,6 @@ filt fun w = [ g!!i | i <- [0..n], res!!i == w ]
110 ( (f, _, g), res ) = fun w 119 ( (f, _, g), res ) = fun w
111 n = (length g) - 1 120 n = (length g) - 1
112 121
113third :: (F, W, [G]) -> [G]
114third (_, _, g) = g
115
116--generate :: F -> (F, W, [G])
117--generate f = \w -> (f, w, [ array (1,2) [ (1,(+)), (2,(+)) ] ] )
118--
119--transform :: (F, W, [G]) -> (F, W, [G])
120--transform fun = fun
121--
122--filt :: (F, W, [G]) -> [G]
123--filt (f, w, g) = g
124 122
125 123
126-------------------------------------------------------------------------------- 124--------------------------------------------------------------------------------