mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
![]() `List.find : List elem, (elem -> Bool) -> Result elem [ NotFound ]*` behaves as follows: ``` >>> List.find [1, 2, 3] (\n -> n > 2) Ok 2 >>> List.find [1, 2, 3] (\n -> n > 4) Err NotFound ``` We implement this as builtin in two phases. First, we call out to a pure-llvm-lowlevel `ListFindUnsafe` that returns a record indicating whether a satisfying element was found, and the value of that element (the value is all null bytes if the element wasn't found). Then, we lift that record to a `Result` via a standard construction of the can AST. Closes #1909 |
||
---|---|---|
.. | ||
helpers | ||
dec.zig | ||
dict.zig | ||
hash.zig | ||
list.zig | ||
main.zig | ||
num.zig | ||
str.zig | ||
utils.zig |