I am trying to do the following in as little code as possible and as functionally as possible:
def restrict(floor : Option[Double], cap : Option[Double], amt : D
This is another way to fix Landei's first answer
def restrict(floor : Option[Double], cap : Option[Double], amt : Double) : Double = { val chopBottom = (floor.getOrElse(amt) max amt) chopBottom min cap.getOrElse(chopBottom) }