I don’t understand the compiler error that says the recursive value `mt`

needs type. Is `mt`

really a recursive value?

```
(2 to 12).foreach { j =>
for {
i <- (0 to 1 << j - 1)
mt = minTerm(j, i)
_ = assert(mt.length == j)
_ = assert(mt.toSet.size == j)
posBits = mt.filter(_ > 0) // this is line 45
j = posBits.foldLeft(0) { (acc: Int, k: Int) =>
acc + (if (k > 0) math.pow(2, k - 1).toInt else 0)
}
} assert(j == i, s"failed for j=$j i=$i posBits=$posBits")
}
```

Here’s the error.

```
Error:(45, 9) recursive value mt needs type
posBits = mt.filter(_ > 0)
```

BTW `minTerm`

is a function which returns `List[Int]`

```
object BitFiddle {
private val prng = scala.util.Random
def minTerm(n: Int, i: Long): List[Int] = {
// Calculate the minTerm as a list of positive and negative integers.
// View i as an n-bit integer. Look at each bit in that integer.
// If the j'th bit is 0, take j, else take -j, and build a list
// of these +/1 j's.
// E.g., if n=3 and i=6, that's binary 110; so build the list
// List(3, 2, -1). The list is actually built with the most
// significant bit at the left, and least significant at the right.
// Each minTerm contains all the integers 1 <= |i| < n in either their
// positive or negative form. I.e., if n=3, then such a minTerm is
// List(3,-2,1) but List(3,-3,2,1) is not and List(3,1) is not.
val nil: List[Int] = Nil
(1 to n).foldLeft((nil, i)) { case ((stack: List[Int], bitMask), position) =>
((if (bitMask % 2 == 1)
position
else
-position) :: stack, bitMask / 2)
}._1
}
...
}
```