User talk:Hout: Difference between revisions

From Rosetta Code
Content added Content deleted
(Check wikipedia?)
 
(95 intermediate revisions by 8 users not shown)
Line 1: Line 1:
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? --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 20:16, 7 September 2015 (UTC)

Latest revision as of 17:32, 18 March 2021