lazy evaluation - Lazily coalesce Options in Scala -
In reducing my priority, there are several ways to calculate the value.
firstWay () second () + route () or A (third y ())
each of these has a option
Gives. I want to "unite" them and get a option
, which is the first some
or none
if all returned back None
.
Of course, if preva ()
returns a something
, then I should not count the rest.
What is the most idiotic (or at least reasonably readable) way to do this?
Prior (). Or Else (sec () + route ()). The logic of algebra (ya (third y ()))
or else
has been evaluated.
See.
Comments
Post a Comment