Collect and sort square numbers in ascending order from three lists: Difference between revisions
Collect and sort square numbers in ascending order from three lists (view source)
Revision as of 03:40, 12 December 2021
, 2 years ago→{{header|Julia}}
(→{{header|Wren}}: Now uses Int.isSquare method.) |
|||
Line 41:
next i</lang>
{{out}}<pre>4 9 16 25 36 36 49 81 121 144 169</pre>
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang jq>def isSquare: sqrt | (. == floor);</lang>
'''The Task'''
def lists: [
[3,4,34,25,9,12,36,56,36],
[2,8,81,169,34,55,76,49,7],
[75,121,75,144,35,16,46,35]
];
[lists[][]] | unique | map(select(isSquare))
</lang>
{{out}}
<pre>
[4,9,16,25,36,49,81,121,144,169]
</pre>
=={{header|Julia}}==
|