On Tue, Oct 7, 2014 at 1:20 PM, Claude Pache <[email protected]> wrote:

>
> > Le 7 oct. 2014 à 21:32, Dmitry Soshnikov <[email protected]> a
> écrit :
> >
> > But all the things from above stands: it's confusing since doesn't
> explain whether it's pre- or post- map, and takes too much at
> implementation.
>
> My previous example could have been written as: `UInt32Array.from('abc', x
> => x.codePointAt(0))` (recalling that strings are iterable in ES6). My
> mapping is neither a pre-, nor a post-map. It's just a map which transforms
> a kind of value (a Unicode character) into another kind of value (a 32-bit
> integer).
>
>
This code example is a good justification of the "an iterable doesn't have
own `map` method", but other than that, it's clearly pre-mapping, since
each element of the result is mapped before being set. The code is
semantically equivalent to:

```
UInt32Array.from('abc'.toArray().map(x => x.codePointAt(0));
```

Dmitry
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to