Edit:
Suppose I have a Seq:
Seq(Some("Earth"),Some("Mars"))
I need to add few more elements at start of this sequence. Values to be added are generated based on an Option value. So I try to do as:
val o = ....//Option calculated here
Seq(o.map(myFunction(_)),"Earth","Mars")
def myFunction(s: String) = s match {
case "x" => Seq(Some("Jupiter"), Some("Venus"))
case "y" => Seq(Some("PLuto"), Some("Mercury"))
}
But map would give me Some(Seq(.....)).
Somethen you want to prepend all the elements returned bymyFunctionif it was aNonethen nothing should be added, right?