Rick Waldron wrote:
On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
I like it, it indeed looks very logical, however it's a bit controversial
that we need to create temporary array object to get one that we want.
Is the controversy editorial or
.
Herby
-Pôvodná správa-
From: Rick Waldron
Sent: Tuesday, January 03, 2012 2:21 AM
To: Adam Shannon
Cc: es-discuss@mozilla.org ; Mariusz Nowak
Subject: Re: Suggestion: Array.prototype.repeat
On Mon, Jan 2, 2012 at 5:55 PM, Adam Shannon a...@ashannon.us wrote:
Another thing to think about
until possible) and it really surprised me it
was that much slower. Concat is probably heavily optimized.
Herby
-Pôvodná správa- From: Rick Waldron
Sent: Tuesday, January 03, 2012 2:21 AM
To: Adam Shannon
Cc: es-discuss@mozilla.org ; Mariusz Nowak
Subject: Re: Suggestion
On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
I like it, it indeed looks very logical, however it's a bit
controversial
that we need
, January 03, 2012 2:30 PM
To: Herby Vojčík
Cc: Rick Waldron ; Adam Shannon ; Mariusz Nowak ; es-discuss@mozilla.org
Subject: Re: Suggestion: Array.prototype.repeat
repeatD(10) returns 17 copies, not 10.
On Tue, Jan 3, 2012 at 4:28 AM, Herby Vojčík he...@mailbox.sk wrote:
Hello,
binary ftw. See http
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
I like it, it indeed looks very logical, however it's a bit
On Tue, Jan 3, 2012 at 9:19 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak
What is the use case for .repeat? Trying to imagine some code where I'd
need it so I can get a feel for how it should work.
On Tue, Jan 3, 2012 at 9:19 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 9:19 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Mon, Jan 2, 2012 at 3:56 PM,
On Tue, Jan 3, 2012 at 10:16 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 9:19 AM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
Rick Waldron wrote:
On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak
On Jan 3, 2012, at 15:46 , Greg Smith wrote:
What is the use case for .repeat? Trying to imagine some code where I'd need
it so I can get a feel for how it should work.
So beauty alone does not count? ;-)
It’s true – there are not a lot of use cases for Array.repeat().
But I keep thinking
I think it's fairly common for range implementations to provide an optional
`step` parameter
On Tue, Jan 3, 2012 at 12:08 PM, Axel Rauschmayer a...@rauschma.de wrote:
On Jan 3, 2012, at 15:46 , Greg Smith wrote:
What is the use case for .repeat? Trying to imagine some code where I'd
need it
I think it's fairly common for range implementations to provide an optional
`step` parameter
Good point. Maybe all of these parameters should be options:
Array.range() - 0, 1, 2, 3, ...
Array.range({ start: 3 }) - 3, 4, 5, 6, ...
Array.range({ end: 5 }) - 0, 1, 2, 3, 4
Array.range({ step: 3
I think step should be 0, and step towards end:
Array.range({start: 5, end: 0, step: 2}) - 5, 3, 1
On Tue, Jan 3, 2012 at 11:42 AM, Axel Rauschmayer a...@rauschma.de wrote:
I think it's fairly common for range implementations to provide an optional
`step` parameter
Good point. Maybe all of
Either way is fine with me. But it’s probably best to copy Python’s semantics:
http://docs.python.org/py3k/library/functions.html#range
On Jan 3, 2012, at 18:50 , Sean Eagan wrote:
I think step should be 0, and step towards end:
Array.range({start: 5, end: 0, step: 2}) - 5, 3, 1
On Tue,
I would be more in favor of something like the code below, its just a
proof of concept.
Array.prototype.range = function (value, start, end, step) {
if (typeof value === number) {
end = (start = 0 value = 0) ? Math.min(value, start) : 0;
start = (start = 0 value = 0) ?
On Tue, Jan 3, 2012 at 12:50 PM, Sean Eagan seaneag...@gmail.com wrote:
I think step should be 0, and step towards end:
Array.range({start: 5, end: 0, step: 2}) - 5, 3, 1
This would be an unfortunate limitation, considering real world impl's
allow negative numbers...
Good point. Maybe all of these parameters should be options:
Array.range() - 0, 1, 2, 3, ...
Array.range({ start: 3 }) - 3, 4, 5, 6, ...
Array.range({ end: 5 }) - 0, 1, 2, 3, 4
Array.range({ step: 3 }) - 0, 3, 6, 9, ...
Array.range({ start: -2, step: -1 }) - -2, -3, -4, -5, ...
etc.
Why
When I first started learning JavaScript I didn't understand how
new Array(n);
worked, in that it creates an empty array with a length of n. What I
had expected was an array with n values (even if it wasn't
well-defined what those values should be). So of course my attempt to
create an array of
is probably heavily optimized.
Herby
-Pôvodná správa- From: Rick Waldron
Sent: Tuesday, January 03, 2012 2:21 AM
To: Adam Shannon
Cc: es-discuss@mozilla.org ; Mariusz Nowak
Subject: Re: Suggestion: Array.prototype.repeat
On Mon, Jan 2, 2012 at 5:55 PM, Adam Shannon
Array.prototype.repeat seems like a logical dual to String.prototype.repeat:
http://wiki.ecmascript.org/doku.php?id=harmony:string.prototype.repeat
Implementation:
Array.prototype.repeat = function (times) {
var result = [];
var len = this.length;
var resultLen =
I like it, it indeed looks very logical, however it's a bit controversial
that we need to create temporary array object to get one that we want.
Function (not method) that returns generated array may make more sense,
currently I'm using something like that:
var slice = Array.prototype.slice;
On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
I like it, it indeed looks very logical, however it's a bit controversial
that we need to create temporary array object to get one that we want.
Function (not method) that returns generated array may make more
Another thing to think about is that .repeat (both on String and
Array) will be used a lot in production. So it would make sense for
each solution to be optimized for their specific case. It doesn't make
sense to slow down something as trivial as .repeat()
On Mon, Jan 2, 2012 at 16:51, Michael A.
On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak
medikoo+mozilla@medikoo.com wrote:
I like it, it indeed looks very logical, however it's a bit controversial
that we need to create temporary array object to get one that we want.
Is the controversy editorial or fact, because the following
On Mon, Jan 2, 2012 at 5:55 PM, Adam Shannon a...@ashannon.us wrote:
Another thing to think about is that .repeat (both on String and
Array) will be used a lot in production. So it would make sense for
each solution to be optimized for their specific case. It doesn't make
sense to slow down
26 matches
Mail list logo