Jump to content

List comprehensions: Difference between revisions

Added Uiua solution
m (→‎{{header|Wren}}: Changed to Wren S/H)
(Added Uiua solution)
Line 2,639:
Pythagorean triples:
[[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>
 
157

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.