List comprehensions: Difference between revisions

no edit summary
No edit summary
Line 137:
 
accum [] for x in 1..n { for y in x..n { for z in y..n { if (x**2 + y**2 <=> z**2) { _.with([x,y,z]) } } } }</lang>
 
=={{header|Efene}}==
 
<lang efene>pythag = fn (N) {
[(A B C) for A in lists.seq(1 N) \
for B in lists.seq(A N) \
for C in lists.seq(B N) \
if A + B + C <= N and A * A + B * B == C * C]
}
 
run = fn () {
io.format("~p~n" [pythag(20)])
}
</lang>
 
=={{header|Erlang}}==
Anonymous user