about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/builtins/mod.rs2
-rw-r--r--tvix/eval/src/vm.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 073edf8ffb7a..ecd19213c3b3 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -277,7 +277,7 @@ fn pure_builtins() -> Vec<Builtin> {
                 let mut res = args.pop().unwrap();
                 let op = args.pop().unwrap();
                 for val in list {
-                    res = vm.call_with(&op, [val, res])?;
+                    res = vm.call_with(&op, [res, val])?;
                     res.force(vm)?;
                 }
 
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 4d049c6d71b0..08c913ed2d6d 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -265,9 +265,10 @@ impl<'o> VM<'o> {
     pub fn call_with<I>(&mut self, callable: &Value, args: I) -> EvalResult<Value>
     where
         I: IntoIterator<Item = Value>,
+        I::IntoIter: DoubleEndedIterator,
     {
         let mut num_args = 0_usize;
-        for arg in args {
+        for arg in args.into_iter().rev() {
             num_args += 1;
             self.push(arg);
         }