From ed69c858a8a98f10509b91ae584a288811fe14a5 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Mon, 14 Oct 2019 14:05:35 -0500 Subject: [PATCH] Use right folds --- src/passes/2-simplify/pascaligo.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index da0675a4a..18f2d8585 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -800,10 +800,10 @@ and simpl_single_instruction : Raw.single_instr -> (_ -> expression result) resu match inj with | [] -> e_skip ~loc () | _ :: _ -> - let assigns = List.fold_left - (fun map (key, value) -> (e_map_add key value map)) - (e_accessor ~loc (e_variable name) access_path) + let assigns = List.fold_right + (fun (key, value) map -> (e_map_add key value map)) inj + (e_accessor ~loc (e_variable name) access_path) in e_assign ~loc name access_path assigns in return_statement @@ expr ) @@ -818,9 +818,9 @@ and simpl_single_instruction : Raw.single_instr -> (_ -> expression result) resu match inj with | [] -> e_skip ~loc () | _ :: _ -> - let assigns = List.fold_left - (fun s hd -> e_constant "SET_ADD" [hd ; s]) - (e_accessor ~loc (e_variable name) access_path) inj in + let assigns = List.fold_right + (fun hd s -> e_constant "SET_ADD" [hd ; s]) + inj (e_accessor ~loc (e_variable name) access_path) in e_assign ~loc name access_path assigns in return_statement @@ expr )