Question: So I'm extracting the lines that I want from this larger file using this program:

```
import csv

name = ['NAMETHEFIRST,' 'NAMEANOTHERNAME ']
data = csv.reader(open('C:\\bigfile.csv'))

with open('C:\\smalldataset.xcl','w') as outf:
    csv.writer(outf).writerows(l for l in data if l[0] in name)

```

The program runs. However I am only getting the line of data from `NAMETHEFIRST` and I get no data from `NAMETHEOTHERNAME` written to my small dataset file. This works exactly as I want printing all relevant info from the large data set of the line of data for NAME THE FIRST but i get no information from the second nametheother name written to the smaller file. Why isn't this working?

Answer: 
Notwithstanding the really weird behavior, `:+` cannot possibly be the operator you want. Since you did not annotate the return type of `unitList`, I don't know what you expected. I assume you wanted to return either `Iterable[Square]` or `Iterable[Iterable[Square]]`. So let's see how you can get them, and why `:+` is incorrect.

First of all, `u1`, `u2` and `u3` are all `Iterable[Iterable[Square]]`, though the exact subtype varies. This should be easy to understand: `cross` returns `Iterable[Square]`, so yielding `cross` in a for-comprehension results in an `Iterable[Iterable[Square]]`.

Next, Let's consider `:+`. This method adds an element to a collection, so, if `u1` is `Iterable(a, b, c)`, where a, b and c are `Iterable[Square]`, then `u1 :+ u2` is `Iterable(a, b, c, u2)`, and its type becomes `Iterable[X]`, where `X` is the unification of `Iterable[Square]` (the type of a, b and c) and `Iterable[Iterable[Square]]` (the type of `u2`). The end result is an `Iterable[Iterable[AnyRef]]`.

Since the type of `u1`, `u2` and `u3` are essentially the same, the correct operation in all likelyhood is this:

```
u1 ++ u2 ++ u3

```

Which will return `Iterable[Iterable[Square]]`. Now, if you want to remove the nesting and return `Iterable[Square]`, you can flatten this:

```
(u1 ++ u2 ++ u3).flatten

```

One of these two things is probably what you want.

Now, as for the "*random*" switching, there's nothing random about it. In each case, there are two for-comprehensions, and the actual implementation of the resulting collection depends on the implementation of the original collection. So, let's consider it:

* u1: outer type derives from `Range`, inner type from `String` (first parameter to cross)
* u2: outer type derives from `String`, inner type from `List` (first parameter to cross)
* u3: outer type derives from `List`, inner type derives from `String` (first parameter to cross)

So it can be easily deduced that for-comprehensions over `String` (`WrappedString`, actually) and `Range` result in `Vector`, while for-comprehensions over `List` result in `List`.
The compiler error occurs because `:+` is a member of `IndexedSeq` (and thus `List`) but not of `Iterable`. If you change the return value of `unitList` from

```
u1 :+ u2 :+ u3

```

to

```
List(u1) :+ u2 :+ u3

```

it compiles just fine.