I'd like to initialize a scala BitSet to contain the integers from 1 to N. The following will work, but I'm looking for a better solution:
var s = BitSet.empty ++ (1 to n)
I was hoping that I could do something like this:
var s:BitSet = (1 to n).toSet
...but that results in an error:
error: polymorphic expression cannot be instantiated to expected type;
found : [B >: Int]scala.collection.immutable.Set[B]
required: scala.collection.immutable.BitSet
Am I missing something obvious?