docjazither
Delete the 1st pair in a map
Hi OGs,
How can I delete the 1st pair in a map ?
Thank you
Most Liked
sodapopcan
OP doesn’t seem to care that they are out of order but I’m dying to know the use-case ![]()
adamu
Please post your code showing how your map is constructed. As @msimonborg said, there is no such concept of the “first” item in a map.
jhogberg
If you don’t specifically need a map, consider using :gb_trees instead. Its take_smallest/1 and take_largest/1 operations are bound to be quicker than converting to list, sorting, deleting the first entry, and then creating a map again.
benwilson512
Yeah this whole exchange is kind of wild.
@docjazither just in case this isn’t abundantly clear: What you’re doing is deleting a random (ish) key from the map. If that’s OK with you then proceed. If it isn’t, please answer one of the several people who asked you to clarify what “first” means to you.
BartOtten
If you want the internet to respont, make an error - Elvis Presley ![]()
ps. quoting the brilliant and definitive answer, rewriting it using Enum.map/2 so you can say it’s wrong… it is Lousy. Jea Lousy. How would you feel if you liked a post and the author edited it and blamed you for something you did not?
Tag: satire







