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.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 1a0443cb6012..3c32129e0537 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -45,6 +45,9 @@ fn pure_builtins() -> Vec<Builtin> {
             let a = args.pop().unwrap();
             Ok(arithmetic_op!(a, b, /))
         }),
+        Builtin::new("length", 1, |args| {
+            Ok(Value::Integer(args[0].as_list()?.len() as i64))
+        }),
         Builtin::new("isAttrs", 1, |args| {
             Ok(Value::Bool(matches!(args[0], Value::Attrs(_))))
         }),