title: Why is cons not a member of immutable.this.IndexedSeq[List[List[scala.this.Tuple2[scala.this.Char,scala.this.Int]]]] curr :: result
body: <p>Given a list of tuples of the form (Char,Int), I want to find the subsets of the list for example if my list was</p>
  <pre><code>List(('a', 2), ('b', 2))
  </code></pre>
  <p>Then my function should return</p>
  <pre><code>List(
    List(),
    List(('a', 1)),
    List(('a', 2)),
    List(('b', 1)),
    List(('a', 1), ('b', 1)),
    List(('a', 2), ('b', 1)),
    List(('b', 2)),
    List(('a', 1), ('b', 2)),
    List(('a', 2), ('b', 2))
  )
  </code></pre>
  <p>I wrote this function</p>
  <pre><code>def combinations(occurrences: List[(Char,Int)]): List[List[(Char,Int)]] = {
    val curr = occurrences filter { case (c,o) =&gt; o != 0}
    if (curr.isEmpty) List(List())
    else {
      val result = for{
        i &lt;- 0 until occurrences.length
      } yield combinations(occurrences.updated(i,(occurrences(i)._1,occurrences(i)._2 - 1)))
      curr :: result
    }
  }
  </code></pre>
  <p>But I keep getting the following error, and I have no idea why seeing as cons should be a member of List[List[(Char,Int)]]. Any Help would be much appreciated.</p>
  <pre><code>ScalaFiddle.scala:8: error: value :: is not a member of immutable.this.IndexedSeq[List[List[scala.this.Tuple2[scala.this.Char,scala.this.Int]]]]
    curr :: result
         ^
  </code></pre>
  <p>I modified my code to be the following</p>
  <pre><code>def combinations(occurrences: List[(Char,Int)]): List[List[(Char,Int)]]      = {
    val curr = occurrences filter { case (c,o) =&gt; o != 0}
    if (curr.isEmpty) List(List())
    else {
      val result = for{
       (c,o) &lt;- curr
      } yield combinations(occurrences.updated(curr.indexOf((c,o)),(c,o-1)))
      curr :: result
    }
  }
  </code></pre>
  <p>but Now I get the following error</p>
  <pre><code>error: type mismatch;
   found   : immutable.this.List[immutable.this.List[scala.this.Product    with scala.this.Serializable{}]]
   required:    List[List[scala.this.Tuple2[scala.this.Char,scala.this.Int]]]
    curr :: result 
  </code></pre>