I'm trying to concatenate 3 sequences as results of individual for loops with yield. I can't get it to work without temporary variables. Does anybody know a better option? The notWorking version gives me a compiler error at the fourth line of the method "illegal start of a simple expression" just after the first ++.
def working() : Seq[Seq[Elem]] = {
val result = for(index <- 0 until COMPLETE_INPUT_CHANNELS) yield {
getModesOfCompleteInputChannel(index)
}
val result2 = for(index <- 0 until INCOMPLETE_INPUT_CHANNELS) yield {
getModesOfIncompleteInputChannel(index)
}
val result3 = for(index <- 0 until OUTPUT_CHANNELS) yield {
getModesOfOutputChannel(index)
}
return result ++ result2 ++ result3
}
def notWorking() : Seq[Seq[Elem]] = {
for(index <- 0 until COMPLETE_INPUT_CHANNELS) yield {
getModesOfCompleteInputChannel(index)
} ++ for(index <- 0 until INCOMPLETE_INPUT_CHANNELS) yield {
getModesOfIncompleteInputChannel(index)
} ++ for(index <- 0 until OUTPUT_CHANNELS) yield {
getModesOfOutputChannel(index)
}