| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Binary search should be used for every `IndexedSeqLike` instance and not only for `IndexedSeq`. According the Scaladoc, it is `IndexedSeqLike` that guarantees "constant-time or near constant-time element access and length computation".
|
|
|
|
|
|
|
|
| |
The public facing binarySearch method used an inclusive 'from'
parameter, while the internal @tailrec one used an *exclusive*
'from' parameter. No wonder there was an off-by-one error somewhere.
This makes both methods use the same exclusive 'from' parameter.
|
|
|
|
|
| |
It should return the position the value would have if it was a part of
the sequence. Somehow even the test was wrong.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Confusing, now-it-happens now-it-doesn't mysteries lurk
in the darkness. When scala packages are declared like this:
package scala.collection.mutable
Then paths relative to scala can easily be broken via the unlucky
presence of an empty (or nonempty) directory. Example:
// a.scala
package scala.foo
class Bar { new util.Random }
% scalac ./a.scala
% mkdir util
% scalac ./a.scala
./a.scala:4: error: type Random is not a member of package util
new util.Random
^
one error found
There are two ways to play defense against this:
- don't use relative paths; okay sometimes, less so others
- don't "opt out" of the scala package
This commit mostly pursues the latter, with occasional doses
of the former.
I created a scratch directory containing these empty directories:
actors annotation ant api asm beans cmd collection compat
concurrent control convert docutil dtd duration event factory
forkjoin generic hashing immutable impl include internal io
logging macros man1 matching math meta model mutable nsc parallel
parsing partest persistent process pull ref reflect reify remote
runtime scalap scheduler script swing sys text threadpool tools
transform unchecked util xml
I stopped when I could compile the main src directories
even with all those empties on my classpath.
|
|
|
|
|
|
|
|
|
| |
No, this isn't busywork, how dare you suggest
such a thing. I intend my tombstone to say
HERE LIES EXTEMPORE,
WHO ELIMINATED A LOT OF SIP-18 WARNINGS
REST IN PEACE
|
| |
|
| |
|
|
|
|
|
|
| |
Change return type to case classes, branch between functions depending
on IndexedSeq instead of IndexedSeqLike, and alter tests accordingly.
Clean up doc comments and reflect changes in them.
|
|
Augments sequence classes with search functionality, using binary
search (comparable to that found in java.util.Collections) for
indexed sequences and linear search for others.
|