Created
February 9, 2021 05:31
-
-
Save mgryszko/8c5d74f7926c01f572f63d9b482fa0c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val pricers = List(priceByTier, priceByUnit) | |
val (_, total) = pricers.foldLeft((quantity, BigDecimal(0))) { | |
case ((quantity, total), pricer) => | |
val (remainingQuantity, amount) = pricer(quantity) | |
(remainingQuantity, total + amount) | |
} | |
total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment