marking2/danube.scala
changeset 284 9a04eb6a2291
parent 259 43995ea34fe7
--- a/marking2/danube.scala	Tue Oct 29 23:56:13 2019 +0000
+++ b/marking2/danube.scala	Wed Oct 30 11:28:44 2019 +0000
@@ -5,7 +5,7 @@
 import io.Source
 import scala.util._
 
-//object CW7b { // for purposes of generating a jar
+object CW7b { // for purposes of generating a jar
 
 // (1) Implement the function get_csv_url which takes an url-string
 //     as argument and requests the corresponding file. The two urls
@@ -118,7 +118,7 @@
 def suggestions(recs: Map[String, List[String]], 
                     mov_name: String) : List[String] = {
   val favs = favourites(recs, mov_name).flatten
-  val favs_counted = favs.groupBy(identity).mapValues(_.size).toList
+  val favs_counted = favs.groupBy(identity).view.mapValues(_.size).toList
   val favs_sorted = favs_counted.sortBy(_._2).reverse
   favs_sorted.map(_._1)
 }
@@ -170,11 +170,11 @@
 //}
 
 // helper functions
-//List().take(2
+//List().take(2)
 //List(1).take(2)
 //List(1,2).take(2)
 //List(1,2,3).take(2)
 
-//}
+}