|
Re: Empty Iterators: msg#00443lang.scala
On 1/27/07, Miles Sabin <miles@xxxxxxxxxxxxxx> wrote: Burak Emir wrote, haha the problem is the other way round: the compiler complains that s.elements is scala.Iterator[A], which is too coarse for the fold, which it has cleverly inferred to return an Iterator[Nothing]. I could do this, you could also just ascribe the type (Iterator.empty:Iterator[A])... object Collections ...or use a "val" here and do this, it would only be needed for these type inference to work... it's not nice to define a def that returns the exact same thing as the val, only with coarser type. I think type ascription is a better solution. You could also give a type argument to foldLeft, and the problem would go away, too. cheers, Burak -- Burak Emir Research Assistant / PhD Candidate Programming Methods Group EPFL, 1015 Lausanne, Switzerland http://lamp.epfl.ch/~emir |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: How do I pattern match the following: 00443, David Pollak |
|---|---|
| Next by Date: | Re: Another nit: 00443, Vijay Saraswat |
| Previous by Thread: | Re: Empty Iteratorsi: 00443, Miles Sabin |
| Next by Thread: | Re: Empty Iterators: 00443, David Pollak |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |