On Tue, Oct 7, 2014 at 3:01 PM, Dmitry Soshnikov <dmitry.soshni...@gmail.com > wrote:
> On Tue, Oct 7, 2014 at 11:59 AM, Dmitry Soshnikov < > dmitry.soshni...@gmail.com> wrote: > >> On Tue, Oct 7, 2014 at 11:56 AM, Claude Pache <claude.pa...@gmail.com> >> wrote: >> >> >>> >>> >>> > Le 7 oct. 2014 à 20:36, Dmitry Soshnikov <dmitry.soshni...@gmail.com> >>> a écrit : >>> > >>> > And other things are better be written: >>> > >>> > ``` >>> > <ArrayKind>.from(iterable).map(mapfn) >>> > ``` >>> > >>> > Am I still missing something? >>> >>> Yes: `UInt32Array.from(['a', 'b', 'c], x => x.codePointAt(0))` >>> >>> >> Still seems the same as `NodeList` "issue": >> >> ``` >> UInt32Array.from(['a', 'b', 'c].map(x => x.codePointAt(0))); >> ``` >> > > And after you have fed the data the `UInt32Array` expects, you can > post-map it as well: > > > ``` > UInt32Array.from(['a', 'b', 'c].map(x => x.codePointAt(0))).map(v => v * > 2); > ``` > > What's is wrong in here? > That example will allocate 2 additional objects; the following version of the same operation will allocate _zero_ additional objects: UInt32Array.from(['a', 'b', 'c], x => x.codePointAt(0) * 2); Rick
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss