Scala: Seq, Map and Set as functions

Yesterday my mate asked me: “I have a List[String] and a Map[String, Int] and I want a List[Int] where its values are those of the Map whose keys match the List[String] elements, maintaining the order. Should I use pattern matching?“. I know, the sentence is a bit convoluted but the code will make it clear, hopefully. Anyway, I replied: “No, you don’t need pattern matching, you just need this”:

The Function class in JavaScript

Most programmers know how to define and use a function in JavaScript. For example the following function displays an alert containing the string passed in as a parameter: functiondisplayAlert(sText){alert(sText);}// Then you call it this way displayAlert("Hello World!"); How many developers, however, know that JavaScript functions are actually objects? Indeed, you can define the previous function using the Function class: vardisplayAlert=newFunction("sText","alert(sText);");//...and you call it the same way displayAlert("Hello World!"); For those who didn’t figure it out, the syntax of the Function class is the following: