@DanaDanger @kelseyinnis
def when[T](p: Boolean, v: T) = if(p) v else null
object S { def apply[T](vs: T*) = vs.to[Seq].filter(_ != null) }
@DanaDanger @kelseyinnis `if(blah) b` has to return Unit, but you could write your own `if` and your own Seq constructor which auto-filters.
-
-
-
@DanaDanger@kelseyinnis Then, e.g. S(1, when(math.random < 0.5, 2), 3)
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.