reset password
Author Message
asmiths
Posts: 12
Posted 17:45 Nov 03, 2012 |

After a lot of brainstorming, I have come up with a game plan to finish the last part of the anagrams assignment, but it requires making sentences larger or adding words onto the end of a sentence.  This is my problem:
 

def addWord(s: Sentence, w: Word): Sentence = {
         s ++ w  // <- this is recognized as a List[Any], not Sentence, even though it would follow to be a List[Word]
        }
 
I have tried setting it to variables and the like, but it ultimately comes down to a type mismatch found: List[Any] expected: Sentence
 
How do I make the compiler see that it is a sentence, not just a List[Any]?
asmiths
Posts: 12
Posted 10:56 Nov 04, 2012 |

Turns out changing to s ++ List(w) worked