Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Main extends App
- {
- def f(acc : Map[Char, String], s: String) = acc.+((s.head, s))
- val myList = List("abc", "bcd", "cde", "def", "efg")
- val w = myList.fold(Map[Char, String]())(f)
- print(w)
- }
- /*
- Error:(58, 44) type mismatch;
- found : (Map[Char,String], String) => scala.collection.immutable.Map[Char,String]
- required: (Object, Object) => Object
- val w = myList.fold(Map[Char, String]())(f)
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement