Simplify UE4 A4
This commit is contained in:
parent
4fa07bb34e
commit
0a6be116ac
@ -191,6 +191,9 @@ Helper functions:
|
||||
> 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
|
||||
|
||||
===================================================================================
|
||||
Aufgabe A.1
|
||||
|
||||
@ -391,15 +394,4 @@ Aufgabe A.4
|
||||
> newtype SaldiertesKassabuch = SKB [(Geschaeftspartner,Saldo)] deriving (Eq,Show)
|
||||
|
||||
> saldiere :: Kassabuch -> SaldiertesKassabuch
|
||||
> saldiere k = create_saldo_cash_book $ konsolidiere k
|
||||
|
||||
> create_saldo_cash_book :: KonsolidiertesKassabuch -> SaldiertesKassabuch
|
||||
> create_saldo_cash_book k = SKB (sortOn fst (get_saldo_per_partner k []))
|
||||
|
||||
> get_saldo_per_partner :: KonsolidiertesKassabuch -> [(Geschaeftspartner,Saldo)] -> [(Geschaeftspartner,Saldo)]
|
||||
> get_saldo_per_partner (KKB(x:xs)) res
|
||||
> | length x /= 0 && null xs = res ++ [(p, (saldo g (KKB([x]))))]
|
||||
> | otherwise = get_saldo_per_partner (KKB(xs)) (res ++ [(p, (saldo g (KKB(x:xs))))])
|
||||
> where
|
||||
> (g,v) = x
|
||||
> p = ppartner_to_partner g
|
||||
> saldiere k = SKB(sortOn fst [(g, saldo g (konsolidiere k)) | (g,v) <- kkb_to_tuples (konsolidiere k)])
|
||||
|
Reference in New Issue
Block a user