Add initial implementation fo UE2 A.4
This commit is contained in:
parent
31f88280e4
commit
cc4469a5c1
@ -318,11 +318,14 @@ calculate_time_diff u1 u2 =
|
|||||||
|
|
||||||
-- Aufgabe A.3
|
-- Aufgabe A.3
|
||||||
|
|
||||||
{- Knapp, aber gut nachvollziehbar geht einzulassende folgendermassen vor:
|
{-
|
||||||
...
|
loop through the list of people
|
||||||
|
if the head is allowed, convert to string and add it to the result list, call the function recursively with the tail of the list
|
||||||
|
if the head is not allowed, call the function recursively with the tail of the list
|
||||||
|
when the tail is empty, terminate
|
||||||
-}
|
-}
|
||||||
|
|
||||||
einzulassende :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> Einzulassende
|
einzulassende :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> Einzulassend
|
||||||
einzulassende p r k = allowed_people p r k []
|
einzulassende p r k = allowed_people p r k []
|
||||||
|
|
||||||
allowed_people :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> [VorUndNachname] -> Einzulassende
|
allowed_people :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> [VorUndNachname] -> Einzulassende
|
||||||
@ -331,14 +334,19 @@ allowed_people (p:ps) r k res
|
|||||||
| (einzulassen (p, r, k)) == Einlassen = allowed_people ps r k (res ++ [person_to_string p])
|
| (einzulassen (p, r, k)) == Einlassen = allowed_people ps r k (res ++ [person_to_string p])
|
||||||
| otherwise = allowed_people ps r k res
|
| otherwise = allowed_people ps r k res
|
||||||
|
|
||||||
|
disallowed_people :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> [VorUndNachname] -> Einzulassende
|
||||||
|
disallowed_people (p:ps) r k res
|
||||||
|
| ps == [] = res
|
||||||
|
| (einzulassen (p, r, k)) == Abweisen = disallowed_people ps r k (res ++ [person_to_string p])
|
||||||
|
| otherwise = disallowed_people ps r k res
|
||||||
|
|
||||||
-- Aufgabe A.4
|
-- Aufgabe A.4
|
||||||
|
{-
|
||||||
--einzulassende_abzuweisende :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> ([Einzulassende],[Abzuweisende])
|
call the function from A.3 to calculate the allowed people, create a new function analogic to the one in A.3 but for disallowed people
|
||||||
|
|
||||||
{- Knapp, aber gut nachvollziehbar geht einzulassende_abzuweisende folgendermassen vor:
|
|
||||||
...
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
einzulassende_abzuweisende :: Einlassbegehrende -> Regel -> Kontrollzeitpunkt -> (Einzulassende,Abzuweisende)
|
||||||
|
einzulassende_abzuweisende p r k = ((einzulassende p r k), (disallowed_people p r k []))
|
||||||
|
|
||||||
-- Aufgabe A.5
|
-- Aufgabe A.5
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user