Stream: beginners

Topic: ✔ Performance of recursion


view this post on Zulip Ryan Bates (Dec 06 2023 at 07:47):

Is recursion encouraged in Roc like it is in other functional languages? I didn't see mention of it in the tutorial or docs.

How's the performance in Roc compared to iterators like List.walk? And do I need to worry about stack overflow?

view this post on Zulip Brendan Hansknecht (Dec 06 2023 at 08:02):

If you write tail recursive functions, recursion is high performance in roc.

view this post on Zulip Brendan Hansknecht (Dec 06 2023 at 08:04):

Also, we have slices, so recursively looping over a list and consuming the first few characters for parsing should be fast.

view this post on Zulip Brendan Hansknecht (Dec 06 2023 at 08:04):

No copying or data shifting should happen

view this post on Zulip Ryan Bates (Dec 06 2023 at 17:14):

Awesome, thanks for the answer

view this post on Zulip Notification Bot (Dec 06 2023 at 17:14):

Ryan Bates has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC