Use right folds
This commit is contained in:
parent
c4babe60d8
commit
ed69c858a8
@ -800,10 +800,10 @@ and simpl_single_instruction : Raw.single_instr -> (_ -> expression result) resu
|
|||||||
match inj with
|
match inj with
|
||||||
| [] -> e_skip ~loc ()
|
| [] -> e_skip ~loc ()
|
||||||
| _ :: _ ->
|
| _ :: _ ->
|
||||||
let assigns = List.fold_left
|
let assigns = List.fold_right
|
||||||
(fun map (key, value) -> (e_map_add key value map))
|
(fun (key, value) map -> (e_map_add key value map))
|
||||||
(e_accessor ~loc (e_variable name) access_path)
|
|
||||||
inj
|
inj
|
||||||
|
(e_accessor ~loc (e_variable name) access_path)
|
||||||
in e_assign ~loc name access_path assigns
|
in e_assign ~loc name access_path assigns
|
||||||
in return_statement @@ expr
|
in return_statement @@ expr
|
||||||
)
|
)
|
||||||
@ -818,9 +818,9 @@ and simpl_single_instruction : Raw.single_instr -> (_ -> expression result) resu
|
|||||||
match inj with
|
match inj with
|
||||||
| [] -> e_skip ~loc ()
|
| [] -> e_skip ~loc ()
|
||||||
| _ :: _ ->
|
| _ :: _ ->
|
||||||
let assigns = List.fold_left
|
let assigns = List.fold_right
|
||||||
(fun s hd -> e_constant "SET_ADD" [hd ; s])
|
(fun hd s -> e_constant "SET_ADD" [hd ; s])
|
||||||
(e_accessor ~loc (e_variable name) access_path) inj in
|
inj (e_accessor ~loc (e_variable name) access_path) in
|
||||||
e_assign ~loc name access_path assigns in
|
e_assign ~loc name access_path assigns in
|
||||||
return_statement @@ expr
|
return_statement @@ expr
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user