GAP:FrequencySort
This article is about a GAP function.
This GAP function is not in-built: you need to copy the code on this page to define the function.
Definition
Function type
This function takes as input a list, and outputs the list of frequencies of various items in the list.
Method
Code
FrequencySort := function(L) local S; S := Set(AsSortedList(L)); return(List(S,x -> [x,Length(Filtered(L,y -> y = x))])); end;;
Paste this code in front of the GAP prompt or copy it to a file and read the file from the GAP prompt.