function CountUniqueItems(Items: TStrings): Integer;
var
List: TStringList;
begin
List := TStringList.Create;
List.Duplicates := dupIgnore;
List.Sorted := True;
List.AddStrings(Items);
Result := List.Count;
List.Free;
end;
begin
...
c := CountUniqueItems(items);
...
end.
use List::Util qw(uniq);
my $c = scalar(uniq @items);
c = len({*items})
c = []
for x in items:
if x not in c:
c.append(x)
c = len(c)
c = 0
for a, x in enumerate(items):
if x not in items[a + 1:]:
c = c + 1
function CountUniqueItems(Items: TStrings): Integer;
var
List: TStringList;
begin
List := TStringList.Create;
List.Duplicates := dupIgnore;
List.Sorted := True;
List.AddStrings(Items);
Result := List.Count;
List.Free;
end;
begin
...
c := CountUniqueItems(items);
...
end.