Remove duplicate elements

From Rosetta Code
Revision as of 21:20, 22 January 2007 by rosettacode>Gfannes
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Remove duplicate elements
You are encouraged to solve this task according to the task description, using any language you may know.

Given a Array, create a derived Array containing only the unique elements

Ruby

 ary = [1,1,2,1,'redundant',[1,2,3],[1,2,3],'redundant']
 uniq_ary = ary.uniq
 # => [1, 2, "redundant", [1, 2, 3]]