User talk:Hout: Difference between revisions

From Rosetta Code
Content added Content deleted
(Matches all three criteria, and arguably to a higher degree than the example which has been left in place.)
 
(Check wikipedia?)
Line 14: Line 14:


Both examples are illustrative of such resources as JavaScript is currently able to provide for patterns of this kind.
Both examples are illustrative of such resources as JavaScript is currently able to provide for patterns of this kind.

: Hi Hout, unfortunately map & filter are the other way of doing things that are not list comprehensions. map&filter are arguably as well known a method as list comprehensions and some languages have both map & filter and list comprehensions as part of the language. The [[wp:List comprehension]] article also makes the distinction up front. Maybe I should add that fact to the task? --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 20:16, 7 September 2015 (UTC)

Revision as of 20:16, 7 September 2015

Restored this on the grounds that it matches all three of the stated requirements:

- They should be distinct from (nested) for loops within the syntax of the language. - They should return either a list or an iterator (something that returns successive members of a collection, in order). - The syntax has parts corresponding to that of set-builder notation.

It uses no for loops, returns a list, and has the parts corresponding to set-building notation.

The previous alternative is useful, but is restricted to a smaller subset of JavaScript, and arguably uses for loops.

If we are to delete one, we should delete both, but I am not sure that either approach has much value.

Both examples are illustrative of such resources as JavaScript is currently able to provide for patterns of this kind.

Hi Hout, unfortunately map & filter are the other way of doing things that are not list comprehensions. map&filter are arguably as well known a method as list comprehensions and some languages have both map & filter and list comprehensions as part of the language. The wp:List comprehension article also makes the distinction up front. Maybe I should add that fact to the task? --Paddy3118 (talk) 20:16, 7 September 2015 (UTC)