Thanks Chris. This doesn't feel like an API change, but rather the addition of a new protocol. The only API change I can foresee is if we want to deprecate Enum.at in favor of Sequence.
My concern with the proposal above is that I don't believe List should implement such protocol, exactly because access is not constant time - if the best we can guarantee is linear time - then Enum can address it. Some of the other benefits can also be achieved in Enumerable today. For example, Sequence.product could be made part of Enum. If the concern is lack of guarantees regarding termination, we could add a new function to the Enumerable protocol, such as aggregate, with the same API as reduce, except it should only be implemented if termination is guaranteed. Also note that implementing a function such as Sequence.replace would require new additions to the protocol if you want to keep the shape of the data type. And keep in mind that you can't also have different implementations for Binary and String - they are the same data type. Luckily both functionalities can be handled by Access - since accessors are not polymorphic on the data type but on the accessor function. If we consider those concerns and limitations, I see two benefits: 1. Guarantee of termination 2. Guarantee of constant-time index access I can really see the benefits of the former but a bit skeptical on the benefits of the latter. The two primary constant time access data-structures in Elixir, tuples and binaries, are better handled with pattern-matching than with functions. With those concerns in mind, how would you change your proposal? *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D On Sat, Jul 22, 2017 at 9:20 AM, <[email protected]> wrote: > Streams created by the Stream module would not be inherently Sequential, > but streams created via the Stream.sequence/1 function would be assumed > to be interminable, but sequential, Sequences. > > -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/elixir-lang-core/a7a7d5a8-7d99-415b-aa0c- > 56ba6baf27b3%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/a7a7d5a8-7d99-415b-aa0c-56ba6baf27b3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BwdKv1205%3DL8YEksAYv1%2BVQkTiuRivzUKzX7PGmxbryA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
