Today I'm studying Elixir protocols and stumbled upon something I found 

Enumerable came to mind pretty quickly for me as a good example for 
protocols. The interesting thing that I noticed is the default 
implementations of Enumerable for Elixir types is a little underwhelming. 
In particular count/1 and member?/2 aren't even implemented on the 
protocol. As it turns out, I discovered that _many_ Enum functions for 
lists in Enum directly instead of in terms of the protocol (e.g.
Of course, I understand that the behavior is OK as is, but it seems to 
create a little confusion for me about the purpose of the protocol in 
addition to be a bad example.

I have some suspicion that there might be an optimization involved here, 
but I'm curious to hear more about the reason for this design. Also, I'd 
love to take a shot at any improvements that might be involved.


You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To view this discussion on the web visit
For more options, visit

Reply via email to