Is there a reason we don't have a Set.size? I'm happy to create an issue for it if that is the name we want.
Set.len it exists https://www.roc-lang.org/builtins/Set#len
Wow. How did I miss that. I literally looked at the docs :face_with_peeking_eye:. Alright, thanks :sweat_smile:
Isaac Van Doren has marked this topic as resolved.
Might be smart to put the word size in the doc comments so searching for length or size finds the correct item.
I wonder if it would make sense to rename it to Set.size. Length is not a property that I usually think of sets having.
Same for dictionaries
I really dislike it being different from lists. So I think we should change all or none
Also, weirdly, I think of dictionaries having lengths, but less so sets. Maybe just cause I almost never use sets and have interacted with them more though math, but I use maps and dictionaries way more often so am more used to length.
I would be happy with List.size
Also, weirdly, I think of dictionaries having lengths, but less so sets.
I agree. Maybe it's because the physical analogy of a dictionary is definitely ordered. Whereas sets (as presented in math) are very much definitely not ordered by themselves.
I agree that the name should be consistent between collections, but I think making a separate topic to discuss size seems reasonable. We've never talked about it before!
Last updated: Jun 16 2026 at 16:19 UTC