Like the emphasis on using higher order functions, but what's wrong with simply doing a functional chain of users.filter{}.map{} ?
Developers already know those functions, and using them will probably be more performant than your bespoke solution in terms of memory allocation and processing time.
In your code, map creates and walks an array of size N, and compactMap also creates and walks an array of size N. Whereas in my example filter creates and walks an array of size N, while the second map creates and walks an array of size f(n) (i.e. only the number of filtered elements).
https://gist.github.com/hmlongco/022ca86724d4d5319e781ab31c9aa583