progs/lecture2.scala
author Christian Urban <urbanc@in.tum.de>
Fri, 11 Nov 2016 11:14:59 +0000
changeset 37 38f3868891f0
parent 36 f5ed0fef41b3
child 39 c6fe374a5fca
permissions -rw-r--r--
updated

// sudoku
// some none
// pattern matching



// Implicits
//===========
//
// for example adding your own methods to Strings:
// imagine you want to increment strings, like
//
//     "HAL".increment
//
// you can avoid ugly fudges, like a MyString, by
// using implicit conversions


implicit class MyString(s: String) {
  def increment = for (c <- s) yield (c + 1).toChar 
}

"HAL".increment