fix "map-records.md"

This commit is contained in:
Lesenechal Remi 2019-12-24 16:09:48 +01:00
parent 08471ba246
commit 883d17a9c1

View File

@ -135,21 +135,21 @@ otherwise.
function iter_op (const m : ledger) : unit is function iter_op (const m : ledger) : unit is
block { block {
function aggregate (const i : address ; const j : tez) : unit is block function aggregate (const i : address ; const j : tez) : unit is block
{ if (j > 100) then skip else failwith("fail") } with unit ; { if (j > 100mutez) then skip else failwith("fail") } with unit ;
} with map_iter(aggregate, m) ; } with map_iter(aggregate, m) ;
``` ```
<!--CameLIGO--> <!--CameLIGO-->
```cameligo ```cameligo
let iter_op (m : ledger) : unit = let iter_op (m : ledger) : unit =
let assert_eq = fun (i: address) (j: tez) -> assert (j > 100) let assert_eq = fun (i: address) (j: tez) -> assert (j > 100tz)
in Map.iter assert_eq m in Map.iter assert_eq m
``` ```
<!--ReasonLIGO--> <!--ReasonLIGO-->
```reasonligo ```reasonligo
let iter_op = (m: ledger): unit => { let iter_op = (m: ledger): unit => {
let assert_eq = (i: address, j: tez) => assert(j > 100); let assert_eq = (i: address, j: tez) => assert(j > 100mutez);
Map.iter(assert_eq, m); Map.iter(assert_eq, m);
}; };
``` ```
@ -162,21 +162,21 @@ let iter_op = (m: ledger): unit => {
```pascaligo ```pascaligo
function map_op (const m : ledger) : ledger is function map_op (const m : ledger) : ledger is
block { block {
function increment (const i : address ; const j : tez) : tez is block { skip } with j + 1 ; function increment (const i : address ; const j : tez) : tez is block { skip } with j + 1mutez ;
} with map_map(increment, m) ; } with map_map(increment, m) ;
``` ```
<!--CameLIGO--> <!--CameLIGO-->
```cameligo ```cameligo
let map_op (m : ledger) : ledger = let map_op (m : ledger) : ledger =
let increment = fun (_: address) (j: tez) -> j+1 let increment = fun (_: address) (j: tez) -> j + 1tz
in Map.map increment m in Map.map increment m
``` ```
<!--ReasonLIGO--> <!--ReasonLIGO-->
```reasonligo ```reasonligo
let map_op = (m: ledger): ledger => { let map_op = (m: ledger): ledger => {
let increment = (ignore: address, j: tez) => j + 1; let increment = (ignore: address, j: tez) => j + 1tz;
Map.map(increment, m); Map.map(increment, m);
}; };
``` ```
@ -196,22 +196,22 @@ It eventually returns the result of combining all the elements.
```pascaligo ```pascaligo
function fold_op (const m : ledger) : tez is function fold_op (const m : ledger) : tez is
block { block {
function aggregate (const i : address ; const j : (tez * tez)) : tez is block { skip } with j.0 + j.1 ; function aggregate (const j : tez ; const cur : (address * tez)) : tez is j + cur.1 ;
} with map_fold(aggregate, m , 10) } with map_fold(aggregate, m , 10mutez)
``` ```
<!--CameLIGO--> <!--CameLIGO-->
```cameligo ```cameligo
let fold_op (m : ledger) : ledger = let fold_op (m : ledger) : ledger =
let aggregate = fun (ignore: address) (j: tez * tez) -> j.0 + j.1 let aggregate = fun (j: tez) (cur: address * tez) -> j + cur.1 in
in Map.fold aggregate m 10 Map.fold aggregate m 10tz
``` ```
<!--ReasonLIGO--> <!--ReasonLIGO-->
```reasonligo ```reasonligo
let fold_op = (m: ledger): ledger => { let fold_op = (m: ledger): ledger => {
let aggregate = (ignore: address, j: (tez, tez)) => j[0] + j[1]; let aggregate = (j: tez, cur: (address, tez)) => j + cur[1];
Map.fold(aggregate, m, 10); Map.fold(aggregate, m, 10tz);
}; };
``` ```