Stream: ideas

Topic: Iter niceties


view this post on Zulip Dan G Knutson (Oct 12 2026 at 15:30):

When using Roc on some old Advent of Code problems, I ran into a couple List methods that would be nice to have on Iter. Specifically, a version of first that would automatically deal with Skips, and something like keep_oks or a 'filter_map'.

Are QoL Iter methods like that already planned somewhere, and/or would PRs for that kind of thing be welcome?

view this post on Zulip Richard Feldman (Oct 12 2026 at 15:46):

oh I think first should just automatically deal with skips :thinking:

view this post on Zulip Richard Feldman (Oct 12 2026 at 15:47):

keep_oks sounds good :+1:

view this post on Zulip Richard Feldman (Oct 12 2026 at 15:47):

happy to accept a PR for it!

view this post on Zulip Dan G Knutson (Oct 15 2026 at 17:56):

I'm opening a PR adding Iter.first (I was remembering the behavior of Iter.next before), and a PR for running the doctests for builtins. The first one is straightforward, but I'm not sure what the right approach is for the testing change.

https://github.com/roc-lang/roc/pull/12256
https://github.com/roc-lang/roc/pull/12265

view this post on Zulip Luke Boswell (Oct 15 2026 at 19:39):

Could you add a fuzz target using roc-fuzz to test it maybe?

Ive got a lot of targets for the builtins, and that has been helpful to find issues.

view this post on Zulip Dan G Knutson (Oct 15 2026 at 20:21):

Fuzzing the builtins makes sense to me! The immediate question is about whether the existing doc tests should go through the interpreter and/or the dev backend.

view this post on Zulip Luke Boswell (Oct 15 2026 at 20:27):

My guess is either is ok


Last updated: Nov 04 2026 at 18:54 UTC