mirror of
https://github.com/enso-org/enso.git
synced 2024-11-27 16:16:21 +03:00
Add comment about using HashMap in future once available. (#3234)
* Add comment about using HashMap in future once available. * [ci no changelog needed] * More detail in ToDo comment.
This commit is contained in:
parent
8387375d83
commit
f9e78a5caa
@ -755,6 +755,16 @@ type Vector
|
|||||||
[Pair 1 "a", Pair 2 "b", Pair 1 "c"] . distinct (on = _.first) == [Pair 1 "a", Pair 2 "b"]
|
[Pair 1 "a", Pair 2 "b", Pair 1 "c"] . distinct (on = _.first) == [Pair 1 "a", Pair 2 "b"]
|
||||||
distinct : (Any -> Any) -> Vector Any
|
distinct : (Any -> Any) -> Vector Any
|
||||||
distinct (on = x->x) =
|
distinct (on = x->x) =
|
||||||
|
## TODO [JD] This is based on the Map class until a HashMap is available.
|
||||||
|
|
||||||
|
Current implementation allows for a consistent distinct with the Enso `==` operator.
|
||||||
|
Using the Map, is less efficient than a HashMap based as requires searching the tree (O(Log N)).
|
||||||
|
A HashMap would allow for a O(1) operation to confirm if an item has been seen already.
|
||||||
|
There is no native HashMap within Enso at present, and the polyglot approach does not produce
|
||||||
|
consistent results with the `==` operator.
|
||||||
|
|
||||||
|
More details on the HashCode / HashMap ticket https://www.pivotaltracker.com/story/show/181027272.
|
||||||
|
|
||||||
recovered = Panic.recover
|
recovered = Panic.recover
|
||||||
builder = here.new_builder
|
builder = here.new_builder
|
||||||
this.fold Map.empty existing->
|
this.fold Map.empty existing->
|
||||||
|
Loading…
Reference in New Issue
Block a user