summaryrefslogtreecommitdiffstats
path: root/AufgabeFFP6.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AufgabeFFP6.hs')
-rw-r--r--AufgabeFFP6.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/AufgabeFFP6.hs b/AufgabeFFP6.hs
index b4bb34b..b786854 100644
--- a/AufgabeFFP6.hs
+++ b/AufgabeFFP6.hs
@@ -5,10 +5,10 @@ where
5 5
6import Data.Array 6import Data.Array
7 7
8type F = Array Int Int 8type F = Array Int Int
9type Op = Int -> Int -> Int 9type Op = Int -> Int -> Int
10type G = Array Int (Op) 10type G = Array Int (Op)
11type W = Int 11type W = Int
12 12
13-------------------------------------------------------------------------------- 13--------------------------------------------------------------------------------
14 14
@@ -17,7 +17,7 @@ type W = Int
17 17
18myfoldl :: [(a -> b -> a)] -> a -> [b] -> a 18myfoldl :: [(a -> b -> a)] -> a -> [b] -> a
19myfoldl _ f1 [] = f1 19myfoldl _ f1 [] = f1
20myfoldl (g:gs) f1 (f2:fs) = myfoldl gs (g f1 f2) fs 20myfoldl (g:gs) f1 (f2:fs) = myfoldl gs (g f1 f2) fs
21 21
22myfoldl' :: [(a -> a -> a)] -> [a] -> a 22myfoldl' :: [(a -> a -> a)] -> [a] -> a
23myfoldl' g (f:fs) = myfoldl g f fs 23myfoldl' g (f:fs) = myfoldl g f fs
@@ -36,10 +36,9 @@ yield = yield_bt
36type Node = ([Int], [Int], W, [Op]) 36type Node = ([Int], [Int], W, [Op])
37 37
38goal_yield_bt :: Node -> Bool 38goal_yield_bt :: Node -> Bool
39goal_yield_bt (f, f', w, g) 39goal_yield_bt (_, _, _, []) = False -- no operators
40 | length g == 0 = False -- no operators 40goal_yield_bt (f, [], w, g) = eval (listArray (1, length f) f) (listArray (1, length g) g) == w
41 | length f' == 0 = eval (listArray (1, length f) f) (listArray (1, length g) g) == w 41goal_yield_bt (_, _, _, _) = False
42 | otherwise = False
43 42
44succ_yield_bt :: Node -> [Node] 43succ_yield_bt :: Node -> [Node]
45succ_yield_bt (_, [], _, _) = [] 44succ_yield_bt (_, [], _, _) = []
@@ -89,7 +88,7 @@ yield_bt f w = map (\(_, _, _, g) -> listArray (1, length g) g) nodes
89 88
90-------------------------------------------------------------------------------- 89--------------------------------------------------------------------------------
91 90
92-- yield_gtf :: Array Int Int -> Int -> [Array Int (Int -> Int -> Int)] 91-- yield_gtf :: F -> W -> [G]
93 92
94-------------------------------------------------------------------------------- 93--------------------------------------------------------------------------------
95 94