Collect and sort square numbers in ascending order from three lists: Difference between revisions
Content added Content deleted
(→{{header|Wren}}: Now uses Int.isSquare method.) |
|||
Line 41: | Line 41: | ||
next i</lang> |
next i</lang> |
||
{{out}}<pre>4 9 16 25 36 36 49 81 121 144 169</pre> |
{{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}}== |
=={{header|Julia}}== |