Author | Message |
---|---|
cydneyauman
Posts: 12
|
Posted 22:54 Oct 31, 2012 |
I used the hint for combinations that was posted on the wiki much earlier in the week. I'm getting an error on the line 1 <- 1 to n. This type of for expression was discussed in this weeks lectures, does it not work on a list of lists?
def combinations(occurrences: Occurrences): List[Occurrences] = occurrences match {
|
rabbott
Posts: 1649
|
Posted 23:11 Oct 31, 2012 |
Are you talking about this part:
val addHead: List[List[Occurrences]] =
for {
i <- 1 to n
} yield (c, i) :: subcombinations
subcombinations is of type List[Occurrences] Does it really make sense to attach (c, i) to the front of such a list? You probably want to attach (c, i) to each element in that list, since each element is of type Occurrences. Last edited by rabbott at
09:26 Nov 01, 2012.
|