Skip to content

Instantly share code, notes, and snippets.

@dsugden
Created June 17, 2014 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsugden/c967226c2ed88bb87d07 to your computer and use it in GitHub Desktop.
Save dsugden/c967226c2ed88bb87d07 to your computer and use it in GitHub Desktop.
case class Better(total : List[Int])
object Better{
def sum(i:Int)(b:Better):(Better,Int) = {
val result = if(b.total.length > 1) 99 else b.total.sum
val newBetter = b.copy(total = i :: b.total)
(newBetter, result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment