summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-05-14 15:25:23 +0200
committermanuel <manuel@mausz.at>2012-05-14 15:25:23 +0200
commit66e6cf52c24e0db7ab0fcba6c84cf9df65ab88e6 (patch)
treefc811f82013624ad08906725377b6375af70ff04
parente69ce73532aacaeda9958ac523ab7e49e9470ce1 (diff)
downloadffp-66e6cf52c24e0db7ab0fcba6c84cf9df65ab88e6.tar.gz
ffp-66e6cf52c24e0db7ab0fcba6c84cf9df65ab88e6.tar.bz2
ffp-66e6cf52c24e0db7ab0fcba6c84cf9df65ab88e6.zip
implement part 3 of assignment 6
-rw-r--r--AufgabeFFP6.hs28
1 files changed, 27 insertions, 1 deletions
diff --git a/AufgabeFFP6.hs b/AufgabeFFP6.hs
index 49d4e41..2e0a021 100644
--- a/AufgabeFFP6.hs
+++ b/AufgabeFFP6.hs
@@ -1,8 +1,19 @@
1{-# LANGUAGE FlexibleInstances #-}
2
1module AufgabeFFP6 3module AufgabeFFP6
2where 4where
3 5
4import Data.Array 6import Data.Array
5 7
8(+) :: Int -> Int -> Int
9(+) = (Prelude.+)
10
11(-) :: Int -> Int -> Int
12(-) = (Prelude.-)
13
14(*) :: Int -> Int -> Int
15(*) = (Prelude.*)
16
6(./.) :: Int -> Int -> Int 17(./.) :: Int -> Int -> Int
7(./.) = div 18(./.) = div
8 19
@@ -18,5 +29,20 @@ eval a b = myfoldl' (elems b) (elems a)
18 29
19-------------------------------------------------------------------------------- 30--------------------------------------------------------------------------------
20 31
21--yield :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)] 32-- yield :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)]
33-- yield = yield_bt
34-- yield = yield_gtf
35
36-- yield_bt :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)]
37-- yield_gtf :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)]
38
39--------------------------------------------------------------------------------
40
22 41
42instance Show (Int -> Int -> Int) where
43 show op = case (3 `op` 3) of
44 6 -> "plus"
45 0 -> "minus"
46 9 -> "times"
47 1 -> "div"
48 _ -> "unknown"