Jump to content

List comprehensions: Difference between revisions

PascalABC.NET
(Added Uiua solution)
(PascalABC.NET)
 
Line 1,733:
{{works with|PARI/GP|2.4.2}}
<syntaxhighlight lang="parigp">f(n)=select(vector(n^3,i,vector(3,j,i\n^(j-1)%n)),v->norml2(v)==2*v[3]^2)</syntaxhighlight>
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
(1..20).CartesianPower(3).Where(\(x,y,z) -> (x*x + y*y = z*z) and (x < y)).PrintLines
</syntaxhighlight>
{{out}}
<pre>
[3,4,5]
[5,12,13]
[6,8,10]
[8,15,17]
[9,12,15]
[12,16,20]
</pre>
 
=={{header|Perl}}==
222

edits

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