I was going to suggest a Set, now that ECMA has them…
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-set-objects
```js
if ((new Set([1,2,3,5]).has(a)) {
// stuff
}
```
On Sun, Aug 9, 2015 at 4:20 PM wrote:
> it could be used like this:
>
> if ( a == 1 ||= 2 ||=3 ||=5) { //
try foo();
catch bar();
finally cleanUp();
in the same spirit as
if (foo) doFoo();
else doBar();
-Michael A. Smith
On Wed, Apr 18, 2012 at 5:45 AM, Jussi Kalliokoski
wrote:
>
>> Silent catch-alls like that are almost always bad code. I think the
>> language rather shouldn&
+1 on clear() as it's pithy, understandable, and behaves the same in
Java and Python.
What real benefit comes from drawing this connection between delete()
and deleteAll()? I suspect the everyday programmer won't care, and the
ones who do will look it up.
-Michael A. Smith
On Wed, Fe
ng.
But hypothetically let's say we do want to go with insertion-order. In
that case, what happens to the order when you attempt to insert an
element that already exists in the set?
OrderedSet('a', 'b', 'c').insert('b')
Is that
#x27;bar', 'baz']), which requires two constructions, one of which is
essentially a waste. If allowing both forms of the constructor is
distasteful, then why not just go with the multiple parameters,
approach, and implement toSet() as a method on appropriate Iterables?
-Michael A
such
methods. Something like
someVeryLargeArray.iMap(someFunction); // Lazy, guaranteed only to be iterable
(No apologies to the email protocol.)
What do you think?
-Michael A. Smith
On Fri, Feb 3, 2012 at 3:54 PM, Domenic Denicola
wrote:
>
> iterator.map(mapper).some(predicate) //
Sorry for the resend. Meant to include the list.
I like this idea a lot! However, what would be the correct behavior of
a method like 'every' on an infinite generator?
-Michael A. Smith
On Fri, Feb 3, 2012 at 3:54 PM, Domenic Denicola
wrote:
> ES5's existing array extras
urely
be useful.)
Michael A. Smith
Web Developer
True Action Network, an eBay Company
On Tue, Jan 3, 2012 at 1:12 PM, Rick Waldron wrote:
>
>
> On Tue, Jan 3, 2012 at 12:50 PM, Sean Eagan wrote:
>>
>> I think step should be > 0, and step towards end:
>>
>>
the difference in overhead between instantiating a new array and
using Array.prototype.slice.call on arguments really worth sacrificing
consistency with the proposed string.prototype.repeat and the very
clean syntax of someArray.repeat(n)?
Michael A. Smith
Web Developer
True Action Network (a
allow the developer to decide the starting index?
String.prototype.until = function (start, needle) {
return "" + (this.substr(start, this.indexOf(needle)) || this);
}
(The ["" +] part is probably not necessary, but it makes it easier to
see the implementation work in
10 matches
Mail list logo