This file contains hidden or 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
| trait M[T] { | |
| def flatMap[U](f: T => M[U]) : M[U] | |
| def unit[T](x: T) : M[T] | |
| } | |
| // Example using Try Monad | |
| import scala.util.Try |
This file contains hidden or 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
| package week7 | |
| // Rearranged from https://class.coursera.org/progfun-004 | |
| // Water pouring problem - CS212 Unit 4 - Udacity | |
| // http://www.youtube.com/watch?v=q6M_pco_5Vo | |
| class WaterPouring(capacities: Vector[Int]) { | |
| /* | |
| * Inventory | |
| */ |