Talk:List comprehensions: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Remove Algol?: new section)
Line 4: Line 4:


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. --[[User:Paddy3118|Paddy3118]] 04:13, 16 April 2009 (UTC)
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. --[[User:Paddy3118|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 <math>\{x,y,z | x^2+y^2=z^2\}</math> as general set, and then be able to put some constraints over variables (like <math>x, y, z \in [1,n]</math>... 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 <tt>(for x from 1 to n)</tt>, or <tt>for x in 1..n</tt>, or <tt>A <- lists:seq(1,N)</tt>, or <tt>x <- [1..n]</tt>, or <tt>for x in xrange(1,n+1)</tt>. I would delete the first requirements, it is subtly ambiguous. --[[User:ShinTakezou|ShinTakezou]] 21:10, 16 April 2009 (UTC)

Revision as of 21:10, 16 April 2009

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)