Talk:List comprehensions

From Rosetta Code

The Pop11 example does not use the sort of syntax specified in the requirements. --TBH 09:22, 23 May 2008 (MDT)

Remove Algol?

As it states, it is not a list comprehension. This would allow those languages with, or that can construct, the extra syntax to not be hidden amongst multiple languages showing nested loops. --Paddy3118 04:13, 16 April 2009 (UTC)

Some requirements sound strange. Common lisp would be out too. E too. After all, Erlang and the second (and to me first too) Haskell example too. Python too. Clojure too, for how I can understand Clojure. This is because some languages use de facto their way of expressing (nested) "for" loops (language syntax may hide this, but it is what it happens). Maybe just Mathematica can be saved... The most correct example should say it like as general set, and then be able to put some constraints over variables (like ... But doing so in most languages it means to generate the values in the range, that is using a "for" loop syntax (the word for does not need to appear!). And this rules out also syntax like (for x from 1 to n), or for x in 1..n, or A <- lists:seq(1,N), or x <- [1..n], or for x in xrange(1,n+1). I would delete the first requirements, it is subtly ambiguous. --ShinTakezou 21:10, 16 April 2009 (UTC)

Hi ShinYTakezou, I think what truly makes it a list comprehension, is that the language designers have created another syntax, separate from for-loops, aping the main syntactic components of the set builder notation (the /List comprehension article overview tries to show this. If the language designer doesn't give attempt to give a list comprehension in its language then although for-loops would work, what is the point? Python and Haskel do give separate syntax and although the Python list comprehension does include the 'for' keyword, it is separate from a for statement in the syntax of the language. --Paddy3118 16:53, 19 April 2009 (UTC)