[#103241] [Ruby master Bug#17777] 2.6.7 fails to build on macOS: implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99 — eregontp@...
Issue #17777 has been reported by Eregon (Benoit Daloze).
17 messages
2021/04/05
[#103305] [Ruby master Feature#17785] Allow named parameters to be keywords — marcandre-ruby-core@...
Issue #17785 has been reported by marcandre (Marc-Andre Lafortune).
21 messages
2021/04/08
[#103342] [Ruby master Feature#17790] Have a way to clear a String without resetting its capacity — jean.boussier@...
Issue #17790 has been reported by byroot (Jean Boussier).
14 messages
2021/04/09
[#103388] [ANN] Multi-factor Authentication of bugs.ruby-lang.org — SHIBATA Hiroshi <hsbt@...>
Hello,
5 messages
2021/04/12
[#103414] Re: [ANN] Multi-factor Authentication of bugs.ruby-lang.org
— Martin J. Dürst <duerst@...>
2021/04/13
Is there a way to use this multi-factor authentication for (like me)
[#103547] List of CI sites to check — Martin J. Dürst <duerst@...>
Hello everybody,
4 messages
2021/04/22
[#103596] [Ruby master Feature#17830] Add Integer#previous and Integer#prev — rafasoaresms@...
Issue #17830 has been reported by rafasoares (Rafael Soares).
9 messages
2021/04/26
[ruby-core:103615] [Ruby master Feature#17016] Enumerable#accumulate
From:
msiegel@...
Date:
2021-04-27 15:14:52 UTC
List:
ruby-core #103615
Issue #17016 has been updated by RubyBugs (A Nonymous). Thanks everyone continuing to discuss whether to add this method to the Ruby lazy Enumerable! In case it is helpful, please permit me to clarify that this method (and the functional programming pattern it represents) is of **practical**, rather than theoretical benefit. This method underlies the system presented in the following conference talk _ETL and Event Sourcing_, which daily rebuilds all system state by re-processing enumerations of the history of data extracted from external systems: * Part 1: https://www.dropbox.com/s/vibkr2edqmtid9n/047_etl_and_event_sourcing_marc_siegel_panorama_education_part_1.mp4?dl=0 * Part 2: https://www.dropbox.com/s/o6bwxymrkmbepgr/048_etl_and_event_sourcing_marc_siegel_panorama_education_part_2.mp4?dl=0 The implementation of this method we use is published here: * Rubygems: https://rubygems.org/gems/scan_left * Github: https://github.com/panorama-ed/scan_left/ A blog post discussing presenting the gem and discussing its usage is here: https://medium.com/building-panorama-education/scan-left-a-lazy-incremental-alternative-to-inject-f6e946f74c00 Sincere apologies if this additional context is redundant or unnecessary. My intent in presenting this context, again, is to provide context that this is practical code extracted from a production system, rather than a purely theoretical matter of interest. Thanks again! ---------------------------------------- Feature #17016: Enumerable#accumulate https://bugs.ruby-lang.org/issues/17016#change-91710 * Author: parker (Parker Finch) * Status: Open * Priority: Normal ---------------------------------------- ## Proposal UPDATE: Changed proposed method name from `#scan_left` to `#accumulate`. Add an `#accumulate` method to `Enumerable`. ## Background `#accumulate` is similar to `#inject`, but it accumulates the partial results that are computed. As a comparison: ``` [1, 2, 3].inject(0, &:+) => 6 [1, 2, 3].accumulate(0, &:+) => [0, 1, 3, 6] ``` Notably, the `accumulate` operation can be done lazily since it doesn't require processing the entire collection before computing a value. I recently described `#accumulate`, and its relationship to `#inject`, more thoroughly in [this blog post](https://medium.com/building-panorama-education/scan-left-a-lazy-incremental-alternative-to-inject-f6e946f74c00). ## Reasoning We heavily rely on the accumulate operation. We use an [event-sourcing](https://martinfowler.com/eaaDev/EventSourcing.html) pattern, which means that we are scanning over individual "events" and building up the corresponding state. We rely on the history of states and need to do this lazily (we stream events because they cannot fit in memory). Thus the scan operation is much more applicable than the inject operation. We suspect that there are many applications that could leverage the scan operation. [This question](https://stackoverflow.com/questions/1475808/cumulative-array-sum-in-ruby) would be more easily answered by `#accumulate`. It is a natural fit for any application that needs to store the incrementally-computed values of an `#inject`, and a requirement for an application that needs to use `#inject` while maintaining laziness. ## Implementation There is a Ruby implementation of this functionality [here](https://github.com/panorama-ed/scan_left/) and an implementation in C [here](https://github.com/ruby/ruby/pull/3078). Update: @nobu has provided an alternative implementation [here](https://github.com/ruby/ruby/pull/1972). ## Counterarguments Introducing a new public method is committing to maintenance going forward and expands the size of the Ruby codebase -- it should not be done lightly. I think that providing the functionality here is worth the tradeoff, but I understand any hesitation to add yet more to Ruby! ---Files-------------------------------- scan_left_example.rb (2.93 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>