[plt-scheme] The problem with Scala (OT, sorry)

From: John Clements (clements at brinckerhoff.org)
Date: Thu Mar 4 16:11:31 EST 2010

People who are seriously thinking about using Scala as a teaching language need to think harder about examples like this:

scala> (List(List(3,4),List(4,5))).foldLeft (List())({(a,b)=>a:::b}) 
<console>:5: error: type mismatch;
 found   : List[Int]
 required: List[Nothing]
       (List(List(3,4),List(4,5))).foldLeft (List())({(a,b)=>a:::b})


That is: the type checker couldn't figure out what kind of thing (List()) was, so it conservatively decided that it was List[Nothing].  Then, you get an error at some arbitrarily distant location. You can solve this by adding a type annotation to List(). Bflegg. 

(Are things like this inappropriate on plt-scheme?)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20100304/b4be8ad9/attachment.p7s>

Posted on the users mailing list.