aboutsummaryrefslogtreecommitdiff
path: root/sem7/pp/lec5.hs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2022-01-11 12:01:29 +0100
committerJulian T <julian@jtle.dk>2022-01-11 12:01:29 +0100
commit84ae9c0267a32488d5163e4fec325fb723703090 (patch)
tree7b5dc72eee1ce86c401500f0085f1cf4fa7ea427 /sem7/pp/lec5.hs
parent97a67fae19de5c824d4baa7ead1965f97f28483e (diff)
Add exam notes for db and pp
Diffstat (limited to 'sem7/pp/lec5.hs')
-rw-r--r--sem7/pp/lec5.hs22
1 files changed, 1 insertions, 21 deletions
diff --git a/sem7/pp/lec5.hs b/sem7/pp/lec5.hs
index 3340346..37f6b12 100644
--- a/sem7/pp/lec5.hs
+++ b/sem7/pp/lec5.hs
@@ -39,7 +39,7 @@ ispalindrome x = x == reverse' x
-- Okay assuming that a are all integers, i
--- would say that the fype of cfrac :: (Real a, Integral b) -> a -> b -> [b]
+-- would say that the fype of cfrac :: (Real a, Integral b) => a -> b -> [b]
cfrac _ 0 = []
cfrac x n = let intPart = truncate x in
@@ -69,23 +69,3 @@ flatten' (x:xs) = x ++ flatten' xs
-- The function type is therefore flatten' :: [[a]] -> [a]
-- When running :t on flatten' we get the same.
-
-
-valid :: (Integral a, Ord a) => [(a, b)] -> Bool
-valid = recur empty
- where recur _ [] = True
- recur known (pair:rest) =
- if key `member` known
- then False
- else recur (insert key known) rest
- where key = fst pair
-
-
--- TODO, case where key is not in is unhandled
-lookup' :: (Integral a, Ord a) => [(a, b)] -> a -> b
-lookup' (pair:rest) key = if (fst pair) == key
- then (snd pair)
- else lookup' rest key
-
--- I dont see how findfun and lookup are not the same
-findfun = lookup'