Can I "yield" into a Map?
I've tried
val rndTrans = for (s1 <- 0 to nStates;
s2 <- 0 to nStates
if rnd.nextDouble() < trans_probability)
yield (s1 -> s2);
(and with ,
instead of ->
) but I get the error
TestCaseGenerator.scala:42: error: type mismatch;
found : Seq.Projection[(Int, Int)]
required: Map[State,State]
new LTS(rndTrans, rndLabeling)
I can see why, but I can't see how to solve this :-/
Alternative (works on 2.7):
An alternate solution in Scala 2.8: