RosettaCodeData/Task/Remove-duplicate-elements/Pop11/remove-duplicate-elements.pop11

14 lines
330 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
;;; Initial array
lvars ar = {1 2 3 2 3 4};
;;; Create a hash table
lvars ht= newmapping([], 50, 0, true);
;;; Put all array as keys into the hash table
lvars i;
for i from 1 to length(ar) do
1 -> ht(ar(i))
endfor;
;;; Collect keys into a list
lvars ls = [];
appdata(ht, procedure(x); cons(front(x), ls) -> ls; endprocedure);