diff options
| author | totycro <totycro@unknown-horizons.org> | 2012-05-15 03:35:14 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2012-05-15 03:35:14 +0200 |
| commit | ec1324e77472f183f8f3b3ab7add1b60b4f3e008 (patch) | |
| tree | c9bc0d835aea4962831a568cfe518222a2d08a54 /AufgabeFFP6.hs | |
| parent | e61a59a792be2d2d1130067d6691622a32052a6c (diff) | |
| download | ffp-ec1324e77472f183f8f3b3ab7add1b60b4f3e008.tar.gz ffp-ec1324e77472f183f8f3b3ab7add1b60b4f3e008.tar.bz2 ffp-ec1324e77472f183f8f3b3ab7add1b60b4f3e008.zip | |
compiliert immer noch..
Diffstat (limited to 'AufgabeFFP6.hs')
| -rw-r--r-- | AufgabeFFP6.hs | 28 |
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]) | |||
| 96 | generate f w = (f, w, [ array (1,n) [(i, j) | i<-[1..n], j<-[(+)] ] ] ) | 96 | generate 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 ] | 100 | get_combinations :: Integer -> [[(Integer, Op)]] |
| 101 | get_combinations 1 = [[(1,(+))], [(1, (-))], [(1, (*))], [(1,(./.))]] | ||
| 102 | get_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 | ||
| 102 | transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W]) | 111 | transform :: (W -> (F,W,[G])) -> W -> ((F, W, [G]), [W]) |
| 103 | transform fun = fun2 | 112 | transform 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 | ||
| 107 | filt :: (W -> ((F,W,[G]),[W]) ) -> W -> [G] | 116 | filt :: (W -> ((F,W,[G]),[W]) ) -> W -> [G] |
| 108 | filt fun w = [ g!!i | i <- [0..n], res!!i == w ] | 117 | 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 ] | |||
| 110 | ( (f, _, g), res ) = fun w | 119 | ( (f, _, g), res ) = fun w |
| 111 | n = (length g) - 1 | 120 | n = (length g) - 1 |
| 112 | 121 | ||
| 113 | third :: (F, W, [G]) -> [G] | ||
| 114 | third (_, _, 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 | -------------------------------------------------------------------------------- |
