round
>> use of comprehension syntax, but I personally (at least) love the
>syntax
>> in the ES reference
>>
>(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions).
>>
>> The best previous discussion on this that I found
/docs/Web/JavaScript/Reference/Operators/Array_comprehensions).
The best previous discussion on this that I found was six years old
(https://esdiscuss.org/topic/array-comprehensions-shorter-syntax) and
answers some of my questions, raising others. That said, I wanted to ask:
* Why
I often use
```js
Array.from({length: n}, (_, i) => i**2)
Array.from({length: n}, (_, i) => Array.from({length: n}, (_, j) => i*j))
[].concat(...Array.from({length: n}, (_, i) => Array.from({length: n}, (_,
j) => ({i,j,v:i*j} // flattened
```
2017-02-07 23:13 GMT+01:00 kdex :
AFAIK, only TC39 members can champion a proposal.
If you're not a member, you could still write a proposal and hope that
some TC39 member is interested in championing it.
On Tuesday, February 7, 2017 5:05:49 PM CET Ryan Birmingham wrote:
> It wasn't clear from the documentation; who can or
It wasn't clear from the documentation; who can or cannot be a champion?
-Ryan Birmingham
On 7 February 2017 at 10:49, Bob Myers wrote:
> On Tue, Feb 7, 2017 at 6:58 PM, David Bruant wrote:
>
>> At the very least, the proposal will be listed in the stage 0
On Tue, Feb 7, 2017 at 6:58 PM, David Bruant wrote:
> At the very least, the proposal will be listed in the stage 0 proposals
> list [3].
My understanding is that a champion is required even to become stage 0.
___
es-discuss
://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions).
The best previous discussion on this that I found was six years old
(https://esdiscuss.org/topic/array-comprehensions-shorter-syntax) and
answers some of my questions, raising others. That said, I wanted
add it.)
Aside: double-for in array comprehensions is only Pythonic in very
simple cases; it's usually quite hard to read. The functional version
is somewhat better imo:
numbers.flatMap(i => letters.map(j => i+j));
~TJ
___
es-discuss mailing list
e
he syntax in the ES
> reference (
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions
> ).
>
> The best previous discussion on this that I found was six years old (
> https://esdiscuss.org/topic/array-comprehensions-shorter-syntax) and
> answe
mprehensions).
>
> The best previous discussion on this that I found was six years old (
> https://esdiscuss.org/topic/array-comprehensions-shorter-syntax) and
> answers some of my questions, raising others. That said, I wanted to ask:
>
>- Why is the Comprehension Syntax in the refe
/Reference/Operators/Array_comprehensions
).
The best previous discussion on this that I found was six years old (
https://esdiscuss.org/topic/array-comprehensions-shorter-syntax) and
answers some of my questions, raising others. That said, I wanted to ask:
- Why is the Comprehension Syntax
Thanks, I gathered so after your response. This is why 99% of the time I
wait for at least one other person to reply first, and why I *should* wait
the remaining 1%... :)
On Wed, Apr 15, 2015 at 12:34 PM, Tab Atkins Jr. jackalm...@gmail.com
wrote:
On Wed, Apr 15, 2015 at 9:31 AM, Jeremy Martin
On Wed, Apr 15, 2015 at 9:23 AM, monolithed monolit...@gmail.com wrote:
```js
let x = [0, 1, 2];
let y = [3, 4, 5];
// Expected
[ for (i of [x, y]) ...i ];
// Reality
Array.prototype.concat(...[ for (x of [x, y]) i ]);
// Result
[0, 1, 2, 3, 4, 5]
```
Is there any discussion on
Why not just `[...x, ...y]`?
On Wed, Apr 15, 2015 at 12:23 PM, monolithed monolit...@gmail.com wrote:
```js
let x = [0, 1, 2];
let y = [3, 4, 5];
// Expected
[ for (i of [x, y]) ...i ];
// Reality
Array.prototype.concat(...[ for (x of [x, y]) i ]);
// Result
[0, 1, 2, 3, 4, 5]
On Wed, Apr 15, 2015 at 9:31 AM, Jeremy Martin jmar...@gmail.com wrote:
Why not just `[...x, ...y]`?
Obviously that's a solution to the trivial example that monolithed
provided, but it's not a solution to the more general problem he's
alluding to, where you're doing a comprehension and want to
```js
let x = [0, 1, 2];
let y = [3, 4, 5];
// Expected
[ for (i of [x, y]) ...i ];
// Reality
Array.prototype.concat(...[ for (x of [x, y]) i ]);
// Result
[0, 1, 2, 3, 4, 5]
```
Is there any discussion on this subject?
___
es-discuss mailing
It’s important to keep in mind that there is no official version of array
comprehensions, at the moment. So that is something to keep in mind whenever
they are added to the language.
I’d probably implement flatMap() and use it if I ever needed to do something
like this.
On 15 Apr 2015, at 18
you in any way, please correct. Thanks.
On Wed, Apr 15, 2015 at 10:20 AM, Axel Rauschmayer a...@rauschma.de
mailto:a...@rauschma.de wrote:
It’s important to keep in mind that there is no official version of array
comprehensions, at the moment. So that is something to keep in mind
, #a was necessary to convince me. YAGNI. Given #a, #b was sufficient.
Dave, if I've misrepresented you in any way, please correct. Thanks.
On Wed, Apr 15, 2015 at 10:20 AM, Axel Rauschmayer a...@rauschma.de wrote:
It’s important to keep in mind that there is no official version of array
On 15 April 2015 at 18:36, Jeremy Martin jmar...@gmail.com wrote:
Thanks, I gathered so after your response. This is why 99% of the time I
wait for at least one other person to reply first, and why I should wait the
remaining 1%... :)
Heck no! You asking that question clarified the problem
On Wed, Apr 15, 2015 at 2:27 PM Mark S. Miller erig...@google.com wrote:
Dave Herman did an excellent presentation at one of the TC39 meetings that
convinced us all to drop comprehension syntax from ES6. I remember it
surprised us all including, earlier Dave, which led to his presentation.
wrote:
It’s important to keep in mind that there is no official version of array
comprehensions, at the moment. So that is something to keep in mind
whenever they are added to the language.
I’d probably implement flatMap() and use it if I ever needed to do
something like this.
On 15 Apr 2015
On Wed, Apr 15, 2015 at 1:11 PM, monolithed monolit...@gmail.com wrote:
@Mark S. Miller,
Dave Herman did an excellent presentation at one of the TC39 meetings
that convinced us all to drop comprehension syntax from ES6. I remember it
surprised us all including, earlier Dave, which led to
On 01.06.2011 3:06, Waldemar Horwat wrote:
On 05/29/11 07:00, Dmitry A. Soshnikov wrote:
Yeah, and ES also supports them. It's called a generator expression;
in this proposal it would look like:
let squares = (x * x | x data, x 5);
Ahem, that's already a parenthesized comma expression
P.S.: another question I have -- is it worth and makes sense to raise a topic
on considering/standardizing the pattern matching (Dave's proposal)?
http://wiki.ecmascript.org/doku.php?id=strawman:pattern_matching Brendan
mentioned on Twitter that it's too late (?), but IMO this proposal is
On 01.06.2011 10:57, David Herman wrote:
P.S.: another question I have -- is it worth and makes sense to raise a topic on
considering/standardizing the pattern matching (Dave's proposal)?
http://wiki.ecmascript.org/doku.php?id=strawman:pattern_matching Brendan mentioned on
Twitter that it's
On Jun 1, 2011, at 12:21 AM, Dmitry A. Soshnikov wrote:
Ah, come on, of course I didn't compare them apples-to-apples. Just said that
it's more likely that some elegant and powerful syntactic construction/sugar
will be used more often than use-cases with WeakMaps and it turns out that
much
On 05/29/11 07:00, Dmitry A. Soshnikov wrote:
Yeah, and ES also supports them. It's called a generator expression; in this
proposal it would look like:
let squares = (x * x | x data, x 5);
Ahem, that's already a parenthesized comma expression with operands
x * x | x data
and
x 5.
Hi,
Don't get this proposal as a bikesheding, just an idea in case if arrow
functions will win the block-functions.
What about to make a sugar for Array comprehensions based also on arrow
syntax? The same as in Erlang:
let data = [1, 2, 3, 4, 5];
let squares = [x * x | x - data, x 3
2011/5/29 Dmitry A. Soshnikov dmitry.soshni...@gmail.com
Hi,
Don't get this proposal as a bikesheding, just an idea in case if arrow
functions will win the block-functions.
What about to make a sugar for Array comprehensions based also on arrow
syntax? The same as in Erlang:
let data
a sugar for Array comprehensions based also on
arrow syntax? The same as in Erlang:
let data = [1, 2, 3, 4, 5];
let squares = [x * x | x - data, x 3]; // [16, 25]
Basically you are proposing bring in Haskell's syntax for comprehensions
Yeah, here I found a list of other syntax
To: es-discuss@mozilla.org
Subject: Re: Array comprehensions shorter syntax (?)
2011/5/29 Dmitry A. Soshnikov dmitry.soshni...@gmail.com
Hi,
Don't get this proposal as a bikesheding, just an idea in case if arrow
functions will win the block-functions.
What about to make a sugar for Array
into account arrow-functions, seems arrow-comprehensions
aren't so cryptic.
but it’s aslo more extensible... and it don’t introduce anything new
to ES Harmony.
As well as current array-comprehensions; though, paren-free are better IMO.
Dmitry.
Please note that your syntax has to be rejected because we
2011/5/29 Dmitry A. Soshnikov dmitry.soshni...@gmail.com
That's it, exactly. We always looking for a shorter sugar. Though, the main
thing that the sugar shouldn't be cryptic at the same time. Probably
Erlang's list comprehensions are cryptic for someone, but again, taking into
account
Errata: + must be *
ListComprehension : '[' Expression '|' IterableOrFilter
(,IterableOrFilter)* ']'
IterableOrFilter: Id '-' ArrayOrGenerator | BooleanFilter
Jose.
___
es-discuss mailing list
es-discuss@mozilla.org
using bitwise-or to be parenthesized:
blam = {|x = (y | z)| x*x};
But block-lambdas do not use [] where | may be an operator in a single element
initialiser expression, so there's no further incompatibility.
Not so with square brackets.
Array comprehensions using for-in or the replacement
value using bitwise-or to be parenthesized:
blam = {|x = (y | z)| x*x};
But block-lambdas do not use [] where | may be an operator in a single
element initialiser expression, so there's no further incompatibility.
Not so with square brackets.
Array comprehensions using
On May 29, 2011, at 12:52 PM, Dmitry A. Soshnikov wrote:
P.S.: though, btw, IIRC, you said the same when an year ago I proposed arrow
functions or Ruby's blocks and they were refused because of grammar reasons;
today we want them to standardize ;) I mean, perhaps what seems not so needed
38 matches
Mail list logo