Set iterators

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Sun Feb 12 21:21:47 PST 2012


On Feb 12, 2012, at 9:17 PM, Brendan Eich wrote:

> Adam Shannon wrote:
>> Why not include iterators like zip, zipWith, foldLeft, and the like as well?
> 
> foldLeft is called reduce around these parts ;-).
> 
> We do need a good suite of iterators including zip, etc. Let's have a proposal here, we can refine it quickly.

True; a small note, Erlang has good standard library for lists including iterators: http://www.erlang.org/doc/man/lists.html, we can consider it and borrow some.

Dmitry


> Thanks,
> 
> /be
> 
>> 
>> On Sun, Feb 12, 2012 at 18:52, Peter Michaux<petermichaux at gmail.com>  wrote:
>>> In the proposal, iterators for Set are listed as todo. If engine
>>> implementers have decided to start moving forward implementing Sets,
>>> then it would be great if they could get iteration going sooner than
>>> later.
>>> 
>>> http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets
>>> 
>>> Looking at the Array iterators...
>>> 
>>> It doesn't seem very difficult to specify "forEach" as a proposal
>>> sketch. It just has to do the following, doesn't it?
>>> 
>>> var s = new Set();
>>> s.add('alpha');
>>> s.add('beta');
>>> s.forEach(function(element){});
>>> 
>>> "reduce", "every", and "some" seem similarly easy. "reduceRight" is
>>> unnecessary as a set has no order.
>>> 
>>> "filter" and "map" are similarly easy but would return set objects.
>>> 
>>> 
>>> Peter
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>> 
>> 
>> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list