about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r--tvix/eval/src/builtins/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index bdfa791574bb..cd4200a13d3b 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -75,6 +75,20 @@ fn pure_builtins() -> Vec<Builtin> {
 
             Ok(Value::Bool(true))
         }),
+        Builtin::new("any", &[true, true], |args, vm| {
+            for value in args[1].to_list()?.into_iter() {
+                let pred_result = {
+                    vm.push(value);
+                    vm.call_value(&args[0])
+                }?;
+
+                if pred_result.force(vm)?.as_bool()? {
+                    return Ok(Value::Bool(true));
+                }
+            }
+
+            Ok(Value::Bool(false))
+        }),
         Builtin::new("attrNames", &[true], |args, _| {
             let xs = args[0].to_attrs()?;
             let mut output = Vec::with_capacity(xs.len());