Common sorted list: Difference between revisions
Content added Content deleted
m (→Excel LAMBDA: Used built-in UNIQUE) |
|||
Line 565: | Line 565: | ||
</lang> |
</lang> |
||
=={{header|Nim}}== |
|||
We could use a <code>HashSet</code> or an <code>IntSet</code> to deduplicate. We have rather chosen to use the procedure <code>deduplicate</code> from module <code>sequtils</code> applied to the sorted list. |
|||
<lang Nim>import algorithm, sequtils |
|||
proc commonSortedList(list: openArray[seq[int]]): seq[int] = |
|||
sorted(concat(list)).deduplicate(true) |
|||
echo commonSortedList([@[5,1,3,8,9,4,8,7], @[3,5,9,8,4], @[1,3,7,9]])</lang> |
|||
{{out}} |
|||
<pre>@[1, 3, 4, 5, 7, 8, 9]</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |