I understand the capability of python, but that is done through
comprehensions that do not relate to the mapping of key to value.
In ES6 the syntax comes out to:
```
let tuple = {x:3,y:5}
[for (value of map.entries()) if
(Object.keys(tuple).every((tupleKey)=tuple[tupleKey] == value[tupleKey]))
My issue here is that I want to index on complex values. I was under the
impression ES6 maps solve amongst others the problem that with objects -
keys are only strings.
I want to index on 2 (or 100) properties - in this example the x and y
values. I don't want to iterate the whole collection and
It is straightforward to implement a hash function based map as a
subclass of `Map`. Something like:
```js
var HashMap = function() { this._map = new Map(); };
HashMap.set = function(key, value) {
var hash = key.hashCode();
var list = this._map.get(hash);
if (!list) { list = [];
Le 17/02/2014 22:55, Benjamin (Inglor) Gruenbaum a écrit :
My issue here is that I want to index on complex values. I was under
the impression ES6 maps solve amongst others the problem that with
objects - keys are only strings.
With maps, all native types (string, number, boolean, undefined,
On Mon, Feb 17, 2014 at 3:09 PM, Benjamin (Inglor) Gruenbaum
ing...@gmail.com wrote:
I'm trying to work with ES6 Map objects and I ran into an interesting
problem.
Yes! Well done.
We've noticed this too, and considered (a) allowing objects to provide
their own hash and equals operations, as in
Thanks, I was starting to feel like I wasn't explaining my issue very well
given the other replies. I'm glad we agree this is not something user-code
should have to shim for language level collections.
I'm working on several projects that perform statistical analysis and I
wanted to stick to
6 matches
Mail list logo