Fix pattern matching in UE4 A.3

This commit is contained in:
Ivaylo Ivanov 2021-11-11 17:25:33 +01:00
parent 0a6be116ac
commit d305136638

View File

@ -188,9 +188,6 @@ Helper functions:
> K_Gutschrift _ _ -> True
> _ -> False
> ppartner_to_partner :: P_Geschaeftspartner -> Geschaeftspartner
> ppartner_to_partner p = p
> kkb_to_tuples :: KonsolidiertesKassabuch -> [(P_Geschaeftspartner, K_Geschaeftsvorfall)]
> kkb_to_tuples (KKB x) = x
@ -368,6 +365,7 @@ Aufgabe A.3
> (g, v) = x
> calculate_partner_payments :: KonsolidiertesKassabuch -> EuroCent -> EuroCent
> calculate_partner_payments (KKB []) _ = (EC 0 0)
> calculate_partner_payments (KKB(x:xs)) res
> | length x /= 0 && null xs =
> if is_k_credit v then res
@ -378,7 +376,9 @@ Aufgabe A.3
> (g,v) = x
> calculate_partner_credit :: KonsolidiertesKassabuch -> EuroCent -> EuroCent
> calculate_partner_credit (KKB []) _ = (EC 0 0)
> calculate_partner_credit (KKB(x:xs)) res
> | null (x:xs) = res
> | length x /= 0 && null xs =
> if is_k_credit v then res + (ec_gutschrift v)
> else res