Turn a list with common items in to a list of ordered pairs
问题 I am entirely new to functional programming; this is a homework assignment for SML. I have a list of integers and I am trying to get a list of ordered pairs where the second entry of the pair is the number of times the first entry appeared in the initial list. For example: [2,3,3,5] => [(2,1),(3,2),(5,1)] I'm not hoping for somebody to implement this but rather give me an idea of what sort of higher-order function I am looking for, and/or a pointer in the right direction. Again, totally new