Thanks for all the responses?
Ya, what I’m really asking is: “Does anyone have an example of an exemplary use of elem/2?” I’ve never been in a situation where I don’t know the size of a tuple. I always think of the size as being part of the type as it in other functional languages. But thanks for the thoughtful answer, all that does make sense!
I actually wasn’t aware you could use elem in guards! I still think pattern matching is clearer.
The question here is why do you have large tuples? I don’t think I’ve come across one with more than 4 before, though I could be wrong. The type of work I do is very limited to business web apps, but large tuples seem like a massive anti-pattern to me.
I’m having trouble finding it but I remember the docs recommending against put_elem and to pattern match and create a new tuple instead. Though maybe it’s gone and no longer the advice anymore? Or I’m just not looking hard enough.
This interesting as I’m aware of but never used records before.






















