Items tagged with unique unique Tagged Items Feed

Hi there,

 I have a piece of code that uses lists instead of vectors and recently, it crashed, it ran out of memory. Long story short, if I use vectors instead of lists, the performance is much better and optimal (this I knew but I was lazy to translate all my code). However, there's one single line that I cannot efficiently translate and it's the one that uses the function member(). Before, I had the following (it's an oversimplification of my code in order to easily discuss it in here):

I frequently have a list of numbers and what I want is a sorted list of unique elements with a count of how many times each element appears.  Is there some way to do this with ListTools?

Here is my code:

listhist := proc(L)
local S, T, i;
T := table(sparse):
for i in L do T[i] := T[i]+1; end do;
S := sort(map(op,[indices(T)]));
[seq([i,T[i]], i=S)];
end proc:

Page 1 of 1