AppleScript to remove duplicates

Well as I noted in another thread:

I would tend to just write:

use framework "Foundation"

on run
    nub({"Tiago", "Paulo", "Miguel", "Tiago"})
end run


-- nub :: [a] -> [a]
on nub(xs)
    ((current application's NSArray's arrayWithArray:xs)'s ¬
        valueForKeyPath:"@distinctUnionOfObjects.self") as list
end nub

The nub function (defining a version of a list without duplicates) is defined (with a number of other general functions) at:

1 Like