From 66e6cf52c24e0db7ab0fcba6c84cf9df65ab88e6 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 14 May 2012 15:25:23 +0200 Subject: implement part 3 of assignment 6 --- AufgabeFFP6.hs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/AufgabeFFP6.hs b/AufgabeFFP6.hs index 49d4e41..2e0a021 100644 --- a/AufgabeFFP6.hs +++ b/AufgabeFFP6.hs @@ -1,8 +1,19 @@ +{-# LANGUAGE FlexibleInstances #-} + module AufgabeFFP6 where import Data.Array +(+) :: Int -> Int -> Int +(+) = (Prelude.+) + +(-) :: Int -> Int -> Int +(-) = (Prelude.-) + +(*) :: Int -> Int -> Int +(*) = (Prelude.*) + (./.) :: Int -> Int -> Int (./.) = div @@ -18,5 +29,20 @@ eval a b = myfoldl' (elems b) (elems a) -------------------------------------------------------------------------------- ---yield :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)] +-- yield :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)] +-- yield = yield_bt +-- yield = yield_gtf + +-- yield_bt :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)] +-- yield_gtf :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)] + +-------------------------------------------------------------------------------- + +instance Show (Int -> Int -> Int) where + show op = case (3 `op` 3) of + 6 -> "plus" + 0 -> "minus" + 9 -> "times" + 1 -> "div" + _ -> "unknown" -- cgit v1.2.3