tomasmikula / hasheq Goto Github PK
View Code? Open in Web Editor NEWTypeclass-based HashSet/HashMap for Scala
License: Other
Typeclass-based HashSet/HashMap for Scala
License: Other
Currently, only immutable.HashSet
is tested for correctness. We need to add laws and tests for the remaining data structures before we can use them with any confidence.
The laws in immutable.SetRepr
and the fiile immutable.HashMapTest
can serve as a template.
immutable.HashMap
mutable.HashSet
mutable.HashMap
There are currently many compilation warnings. They should be easy to eliminate. Then we should enable scalac
flag -Xfatal-warnings
.
HashSet[A]
is a generalized Boolean algebra (i.e. a potentially topless Boolean algebra).
TotalHashMap[K, V]
is a generalized Boolean algebra whenever V
is a generalized Boolean algebra.
We should provide HashEq
instances for common Scala types. hasheq.std.int
can serve as a template.
Unit
Boolean
String
Char
Long
List
Vector
The original code contains many optimizations, often compromising elegance. Without benchmarks, it is hard to make changes with confidence that they don't negatively affect performance.
A total map is a map that is defined everywhere.
For this data structure, we only consider a special kind of total maps: the ones that are non-zero at at most a finite number of points. TotalHashMap
can then be implemented using an ordinary HashMap
for keys with non-zero values, and assume zero everywhere else.
EDIT: by "zero" I mean any constant value, not necessarily related to any algebraic notion of zero. So a better phrasing would be that we consider total maps that are constant except for at most a finite number of points.
Perhaps laws should be moved to a separate module, to decrease the JAR size of the core, and eliminate core's dependency on ScalaCheck.
immutable.HashSet[A]
is generalized as immutable.HashSetoid[A, Eq]
, which is parameterized by the equivalence relation used. The rest of the data structures should follow the same pattern.
immutable.HashMap
mutable.HashSet
mutable.HashMap
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.