Talk:Comparison of programming languages (list comprehension)
This article is rated List-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
Perl map & grep example deletion
[edit]I have twice deleted a snippet of Perl code, as the page is about list comprehensions and the code used map and grep. The Perl entry would then become in essence:
- "Perl has list comprehensions in our library List:Comprehensions, but I am not going to show you how to use that; instead here is an example of not using List:Comprehensions."
As I stated in the comment on my first edit/deletion of the code, it is not about getting a particular answer, the page is about LC's and they should be used in any example code. --Paddy (talk) 06:58, 16 March 2011 (UTC)
List:Comprehensions is in no way a standard Perl package (look at the version 0.13) and its calling syntax very closely resembles map-grep example up to a point where it feels like a wrapper around map. Also I don't see any examples with conditionals on its web page on CPAN.
Also if you look at the examples for other languages, they frequently show creative usage of the standard constructs of the respective languages that are not list comprehension-specific. Thus, Perl example with map-grep has its right to be on this page. After all, "there is more than one way to do it", so it is perfectly in line with Perl's motto. —Preceding unsigned comment added by 131.107.0.72 (talk) 22:31, 29 April 2011 (UTC)
- Could you point out which other languages are not showing list-comprehensions? Rather than keep them, they should be deleted too.
- You state that the CPAN LC may not be very good. I guess that is a reason not to include it. How it was implemented would not have precluded its inclusion as long as it was looked and worked like an LC.
- On your comment about "there is more than one way to do it" that is all well and dandy, but the page requires the List Comprehension way. Not nested for loops. Not computed goto's; Not map and grep.
- "Perl doesn't have LC's but I want to add map&grep" has already been argued as inappropriate. --Paddy (talk) 06:03, 30 April 2011 (UTC)
Why does this page exist?
[edit]The list comprehension article currently includes more examples than this separate article, but cites this as a "main article" cross-ref for that section. If the intention was to keep the list in the other article short, something has gone very wrong. - IMSoP (talk) 22:41, 21 January 2014 (UTC)
Removal of non-LC examples
[edit]Unless someone can say why not, I am thinking of doing the following edits to remove non LC type syntax in the examples, including all the map+filter based examples as the page is about doing the task using LC's rather than equivalent code for doing the task:
- Remove Io map example
- Remove Java 8 map and filer example.
- Remove Ruby
- Remove Swift
A new comment noting that other languages use map and/or filter functions to achive similar aims should then be added.