List comprehensions: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
(Added Uiua solution) |
||
Line 2,639: | Line 2,639: | ||
Pythagorean triples: |
Pythagorean triples: |
||
[[3, 4, 5], [5, 12, 13], [6, 8, 10], [9, 12, 15]] |
[[3, 4, 5], [5, 12, 13], [6, 8, 10], [9, 12, 15]] |
||
</pre> |
|||
=={{header|Uiua}}== |
|||
<syntaxhighlight lang="uiua"> |
|||
☇1⊞≡⊂⊞⊂..+1⇡20 # Cartesian product, flattened. |
|||
▽⊸≡(=1/↧/≥◫2) # Keep triplets which are in ascending order. |
|||
▽⊸≡(=⊃(/+⊏0_1|⊡2)×.) # Keep pythagorean triplets. |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
╭─ |
|||
╷ 3 4 5 |
|||
5 12 13 |
|||
6 8 10 |
|||
8 15 17 |
|||
9 12 15 |
|||
12 16 20 |
|||
╯ |
|||
</pre> |
</pre> |
||