This page is no longer maintained — Please continue to the home page at www.scala-lang.org

sizeCompare, minSize, or whatever

No replies
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

It looks like this:

https://lampsvn.epfl.ch/trac/scala/ticket/2865

was caused by this line in Zipped:

def length = self.length min other.size

the latter size blithely trying to see how far infinity goes. I
replaced this like so:

def length =
if (other.hasDefiniteSize) self.length min other.size
else other take self.length size

but I quite suspect more locations require treatment.

I see we have a "lengthCompare" method on Seq-derived classes, but as
size is a Traversable method, and zip* methods are on Iterable, I need
something higher in the hierarchy to calculate the smaller size of two
collections in a way which will terminate if either is finite. Any
nominations?

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland