Stream: beginners

Topic: List.reduce


view this post on Zulip Dilson Higa (Jun 15 2024 at 14:58):

First of all, congratulations to everyone working on roc. I'm having the most fun programming with this language, which is something I haven't experienced in quite some time.

For my actual question: is there an alternative to List.walk which uses its first element as the initial state?

Something like:

reduce: List elem, (elem,elem->elem) -> Result elem [ListWasEmpty]

view this post on Zulip Anton (Jun 15 2024 at 15:08):

I do like this kind of reduce from scala, I don't think we've talked about this before, I could not find it at least, you would not believe how many times we've used the word "reduce" in our zulip history :p

view this post on Zulip Anton (Jun 15 2024 at 15:10):

Would you be interested in writing up a tiny proposal @Dilson Higa?

view this post on Zulip Dilson Higa (Jun 15 2024 at 17:49):

I am interested but I don't really know how. I searched the history and found a few proposals (such as the "task as builtin"), but I believe the proposal for this function would be waaaay simpler. Maybe a brief motivation with use cases and the proposal itself?

view this post on Zulip Anton (Jun 15 2024 at 17:58):

Yeah those are big proposals, we typically use the ideas channel for proposals for new builtin functions like reduce. This is a good example of a short proposal.

view this post on Zulip Dilson Higa (Jun 15 2024 at 18:23):

Thank you @Anton . I posted it there. Let's see if there is enough interest in it.


Last updated: Jul 05 2025 at 12:14 UTC