Hi all!
The basic implementation is very straightforward, because of the very helpful documentation in the `Enum` and `Enumerable` modules. Chapeau 😊!
I then used a code coverage tool to try to make sure that all edge cases were exercised by the testing suite. And this is where I found out that triggering one part of the `Enumerable.reduce`-interface is rather hard, as there is nearly no information to find out how to thoroughly write/test it: The usage of `:suspend`/`:suspended`.
I think it is a very nice feature to be able to work with continuations when dealing with enumerables. However, currently neither the Elixir standard library, nor (to my knowledge) any libraries on Hex.PM out there make use of it.
The resources I was able to find are:
- A
bug report of the suspension system, with one example that was then added as a regression test. (2015)
- The Elixir core has
many places where `:suspend`/ `:suspended` are used, but to my knowledge only ever to handle a function that could return `:suspend` (never itself defining a function doing so).
Neither the `interleave` example nor the `regression test` are examples that give much confidence that a particular Enumerable implementation now handles suspensions correctly.
So my proposal would be to add some kind of small example definition to e.g. the documentation of `t Enumerable.result`.
Would this be a good idea? Or is another place better suited?
Also: Does anyone know of other resources/examples where suspensions are currently used?
Thank you for your consideration,
~Marten/Qqwy