Skip to content

@lang:unique

Remove duplicates from an array, preserving first-occurrence order.

On-chain (@lang:unique!): Removes adjacent duplicates only; nest @sort! for set-uniqueness.

Returns: array

@lang:unique(arr)
NameTypeDescription
arrarraySource array
  • @filter — custom duplicate removal

Deduplicate ADJACENT equal words of the array return of a call on-chain through uniqueWords (O(n)). For set-uniqueness over unsorted input, nest @sort!: @unique!(@sort!(…)).

load lang
set $safe 0x44fA8E6f47987339850636F88629646662444217
assert @unique!(@sort!($safe::{getOwners()(address[])})) == 0x1122
  • assert, @sort!