Dumb scala question: is there a nicer way to express this? def foo(opt: Option[List[Int]]) = opt.toList.flatMap{list => list.map{n => n*2}}
@arsatiki yeah, it's not much nicer as a for, though. The main annoying thing is the toList.
-
-
@avibryant@arsatiki shortest I've got is opt.map(_.map(_ * 2)).toList.flatten. *shrug* -
@alexcruise@avibryant@arsatiki I think I beat you on this one :) -
@d6 yeah, gets at the essence of the example better. /cc@avibryant@arsatiki
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.