Remove duplicate elements: Difference between revisions

Content added Content deleted
Line 42: Line 42:


=={{header|AppleScript}}==
=={{header|AppleScript}}==
<lang applescript>set array to {1, 2, 3, "a", "b", "c", 2, 3, 4, "b", "c", "d"}
<lang applescript>unique({1, 2, 3, "a", "b", "c", 2, 3, 4, "b", "c", "d"})

set unique to {}
on unique(x)
repeat with i in array
set R to {}
if i is not in unique then
repeat with i in x
set end of unique to i's contents
if i is not in R then set end of R to i's contents
end if
end repeat
end repeat
return unique</lang>
return R
end unique</lang>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==