From ec1324e77472f183f8f3b3ab7add1b60b4f3e008 Mon Sep 17 00:00:00 2001 From: totycro Date: Tue, 15 May 2012 03:35:14 +0200 Subject: compiliert immer noch.. --- AufgabeFFP6.hs | 28 +++++++++++++--------------- 1 file 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]) generate f w = (f, w, [ array (1,n) [(i, j) | i<-[1..n], j<-[(+)] ] ] ) where n = snd $ bounds f - --ops = [(+), (-), (*), (./.)] - --entries = [ (i, j) | i<-[1..3] , j<-ops ] + +get_combinations :: Integer -> [[(Integer, Op)]] +get_combinations 1 = [[(1,(+))], [(1, (-))], [(1, (*))], [(1,(./.))]] +get_combinations n = [ (up i) ++ entr | entr <- get_combinations (n-1), i <- get_combinations 1 ] + where + up = map (\(num, x) -> ((num+n-1), x)) + +--aget_combinations :: Integer -> [[Op]] +--aget_combinations 1 = [[(+)], [(-)], [(*)], [(./.)]] +--aget_combinations n = [ i ++ entr | entr <- aget_combinations (n-1), i <- aget_combinations 1 ] + transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W]) -transform fun = fun2 +transform fun w = ((f, w, g), map (eval f) g ) where - fun2 = \w -> (fun w, [1]) + (f, w, g) = fun w filt :: (W -> ((F,W,[G]),[W]) ) -> W -> [G] filt 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 ] ( (f, _, g), res ) = fun w n = (length g) - 1 -third :: (F, W, [G]) -> [G] -third (_, _, g) = g - ---generate :: F -> (F, W, [G]) ---generate f = \w -> (f, w, [ array (1,2) [ (1,(+)), (2,(+)) ] ] ) --- ---transform :: (F, W, [G]) -> (F, W, [G]) ---transform fun = fun --- ---filt :: (F, W, [G]) -> [G] ---filt (f, w, g) = g -------------------------------------------------------------------------------- -- cgit v1.2.3