List comprehensions: Difference between revisions

J: rephrase for clarity
(J: rephrase for clarity)
Line 309:
 
=={{header|J}}==
<lang J>(#~ (2&{ triples= 1&{ +&.:*: 0&{)@|:)@(1+3&# #: i.@^&3)</lang>
isPyth=: 2&{ = 1&{ +&.:*: 0&{
pythTr=: (#~ isPyth@|:)@triples</lang>
 
The idiom here has two major elements:
Line 319 ⟶ 321:
Example use:
 
<lang J> (#~ (2&{ = 1&{ +&.:*: 0&{)@|:)@(1+3&# #: i.@^&3)pythTr 12
3 4 5
4 3 5
6,962

edits