Function returning multiple Values - problem with using if-else

2014-10-24 Thread HARIPRIYA AYYALASOMAYAJULA
Hello, My map function will call the following function (inc) which should yield multiple values: def inc(x:Int, y:Int) ={ if(condition) { for(i - 0 to 7) yield(x, y+i) } else { for(k - 0 to 24-y) yield(x, y+k) for(j- 0 to y-16) yield(x+1,j) } } The if part works

Re: Function returning multiple Values - problem with using if-else

2014-10-24 Thread Sean Owen
This is just a Scala question really. Use ++ def inc(x:Int, y:Int) = { if (condition) { for(i - 0 to 7) yield(x, y+i) } else { (for(k - 0 to 24-y) yield(x, y+k)) ++ (for(j- 0 to y-16) yield(x+1,j)) } } On Fri, Oct 24, 2014 at 8:52 PM, HARIPRIYA AYYALASOMAYAJULA

Re: Function returning multiple Values - problem with using if-else

2014-10-24 Thread HARIPRIYA AYYALASOMAYAJULA
Thanks Sean! On Fri, Oct 24, 2014 at 3:04 PM, Sean Owen so...@cloudera.com wrote: This is just a Scala question really. Use ++ def inc(x:Int, y:Int) = { if (condition) { for(i - 0 to 7) yield(x, y+i) } else { (for(k - 0 to 24-y) yield(x, y+k)) ++ (for(j- 0 to y-16)