Maps with object keys

Bradley Meck bradley.meck at gmail.com
Mon Feb 17 13:43:43 PST 2014


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]))
value]
```

A quick comparator function for tuple like objects would be more clear than
comprehension that does not relate to the mapping of key to value. Notice
how the keys of `map` are never used in the comprehension.


On Mon, Feb 17, 2014 at 3:35 PM, Benjamin (Inglor) Gruenbaum <
inglor at gmail.com> wrote:

> Hi, when you reply please reply to the list (that is, include esdiscuss in
> the list of recipients) - otherwise I'm the only one who can read your mail.
>
> As for your question, You might want to look into how maps (or
> dictionaries) work in languages like Python where you can have a dictionary
> with tuple keys for example which would let me index on `(x,y)` values.
> This is of course a very 'simplified' example of what I'm actually doing
> (statistical learning).
>
>
> On Mon, Feb 17, 2014 at 11:31 PM, Bradley Meck <bradley.meck at gmail.com>wrote:
>
>> What you are describing is a Set/Array of data that runs a filter at
>> runtime. Could you go into some detail on why a filter on sets/arrays does
>> not make sense for your use case? I am unsure what the original mapping of
>> key (during .set(key, value)) to value would represent if keys are treated
>> as many-many filters rather than 1-1 relationships for Maps in ES6.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140217/73b3bf8f/attachment.html>


More information about the es-discuss mailing list