std.v2020.algorithm etc[ WAS: Is run.d going to be expand for runtime and the phobos library?]

Petar Petar
Wed Jun 24 09:38:48 UTC 2020


On Tuesday, 23 June 2020 at 21:19:39 UTC, Paul Backus wrote:
> Even without making `each` a primitive, you can do this. 
> Implement a few fundamental algorithms like `each`, `map`, 
> `filter`, and `fold` using recursion, and many others can be 
> built on top of them.

Slightly off-topic, but are you familiar with Clojure's 
transducers?
https://clojure.org/reference/transducers
https://www.youtube.com/watch?v=6mTbuzafcII

You can also check this talk from CppCon, to see how their 
applied to a statically typed language:
https://www.youtube.com/watch?v=6mTbuzafcII

For me, the main advantage is that this design allows 
implementing algorithms like map, filter, etc. without caring at 
all about the exact range interface. This for me is a big deal 
because, in my day-to-day job, I can't use much 
range/iterator/iterable/enumerable pull-style algorithms, because 
most my code is reactive/ asynchronous (push-based). So most of 
what I do is based on either Futures/Promises or Reactive 
Extensions:
http://reactivex.io/
http://reactivex.io/documentation/operators.html


More information about the Digitalmars-d mailing list