- Given a list of Articles,
Cartcalculates the bill summing all thePrices; DiscountCartapplies a 50% discount to all articles whosePriceis greater than 5 CHF;- With
FreeDrinkCartall the drinks are for free; - With
PromotionCartall the articles whousePriceis smaller than 2 CHF are given for free; - In
DiscountCart, the discount and the threshold can be parametrized; - Remove all the duplicated code, applying the Strategy Pattern;
- Replace theinterface and the 3 carts with a delegate and 3 methods;
- Replace the 3 methods with local functions;
- Replace local functions with a local delegate;
- Replace the
delegatein the cart constructor with aFunc; - Simplify the syntax with a Lambda expression.
TicinoXP/lambda-kata
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|