List comprehensions: Difference between revisions
→{{header|SuperCollider}}: modernized and simplified syntax
m (→{{header|Sidef}}: minor code simplifications) |
(→{{header|SuperCollider}}: modernized and simplified syntax) |
||
Line 1,895:
=={{header|SuperCollider}}==
<lang supercollider>
// 10 is the default value of the argument
var pyth = { |n = 10|
all {: [x,y,z],
x <- (1..n),
Line 1,902 ⟶ 1,903:
z <- (y..n),
(x**2) + (y**2) == (z**2)
}
};
pyth.
returns
<lang supercollider>[ [ 3, 4, 5 ], [ 5, 12, 13 ], [ 6, 8, 10 ], [ 8, 15, 17 ], [ 9, 12, 15 ], [ 12, 16, 20 ] ]</lang>
|