diff options
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 45630819e124..94a035c2ece7 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -116,6 +116,20 @@ fn pure_builtins() -> Vec<Builtin> { std::cmp::Ordering::Greater => Ok(Value::Integer(1)), } }), + Builtin::new("concatLists", &[true], |args, vm| { + let list = args[0].to_list()?; + let lists = list + .into_iter() + .map(|elem| { + let value = elem.force(vm)?; + value.to_list() + }) + .collect::<Result<Vec<NixList>, ErrorKind>>()?; + + Ok(Value::List(NixList::from( + lists.into_iter().flatten().collect::<Vec<Value>>(), + ))) + }), Builtin::new( "div", &[false, false], |