title: Convert a scala list of Strings into a list of Doubles while discarding unconvertable strings
body: <p>I'm trying to parse a list of strings into a numeric format, while ignoring anything that can't be parsed. This is my attempt, but I can't help but think it's a common enough pattern that there must be a better way than having to call 2 maps and a filter. Can someone suggest a more canonical way of doing this? Perhaps using a partial function of some kind? Thanks!</p>
  
  <pre><code>val stringList = List("1","2","foo","4")
  val parsed = stringList.map(s =&gt; scala.util.Try(s.toDouble)).filter(_.isSuccess).map(_.get)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>stringList: List[String] = List(1, 2, foo, 4)
  scala&gt; parsed: List[Double] = List(1.0, 2.0, 4.0)
  </code></pre>