List comprehensions: Difference between revisions
m
→{{header|Wren}}: Changed to Wren S/H
m (→{{header|C}}: 3 syntaxhighlight -> 1 plus comment) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 21:
{{trans|Python}}
{{out}}
Line 275:
end mReturn</syntaxhighlight>
{{Out}}
<
=={{header|Arturo}}==
Line 604:
[x, y, z]
))
console.dir pyth 20</syntaxhighlight>
▲<code>pyth</code> can also be written more concisely as
▲<syntaxhighlight lang="coffeescript">pyth = (n) -> flatten (flatten ([x, y, z] for z in [y..n] when x*x + y*y is z*z for y in [x..n]) for x in [1..n])</syntaxhighlight>
=={{header|Common Lisp}}==
Line 2,709 ⟶ 2,707:
=={{header|Wren}}==
Using a generator.
<syntaxhighlight lang="
(1..n-2).each { |x|
(x+1..n-1).each { |y|
|