The Str split/replace family is basically wrapped up, so while I'm on a roll I'd like to grab a few more small List builtins off #9596 — all pure Roc, no new low-level ops. One PR, a commit each (same as the trio / Try section):
List.get_wrap — List(a), U64 -> Try(a, [ListWasEmpty]); index wraps around with %, empty list → Err. (#3485 asks for this one.)List.drop_at_unordered — List(a), U64 -> List(a); cheap O(1) remove by swapping the element with the last and dropping it.List.concat_utf8 — List(U8), Str -> List(U8); tack a string's UTF-8 bytes onto a byte list.Anyone already on these, or any objections? :slight_smile:
Quick follow-up on concat_utf8: turns out there's already a host listConcatUtf8 in builtins/list.zig (one realloc + memcpy, with a unit test), but it's orphaned — no low-level op or Builtin.roc entry wired to it. So for that one I could either wire it up as the low-level op (the efficient path, which also un-orphans the existing code), or keep the pure-Roc List.concat(bytes, Str.to_utf8(str)). Which would you prefer? get_wrap and drop_at_unordered are cleanly pure-Roc either way.
Last updated: Jul 23 2026 at 13:15 UTC