Changed Loop.continue to Loop.resume.
This commit is contained in:
parent
31a39bffbc
commit
623e16459f
@ -79,12 +79,12 @@ let gcd (x,y : nat * nat) : nat =
|
||||
```
|
||||
|
||||
To ease the writing and reading of the iterated functions (here,
|
||||
`iter`), two predefined functions are provided: `Loop.continue` and
|
||||
`iter`), two predefined functions are provided: `Loop.resume` and
|
||||
`Loop.stop`:
|
||||
|
||||
```cameligo group=a
|
||||
let iter (x,y : nat * nat) : bool * (nat * nat) =
|
||||
if y = 0n then Loop.stop (x,y) else Loop.continue (y, x mod y)
|
||||
if y = 0n then Loop.stop (x,y) else Loop.resume (y, x mod y)
|
||||
|
||||
let gcd (x,y : nat * nat) : nat =
|
||||
let x,y = if x < y then y,x else x,y in
|
||||
@ -92,7 +92,8 @@ let gcd (x,y : nat * nat) : nat =
|
||||
in x
|
||||
```
|
||||
|
||||
> Note that `stop` and `continue` are *deprecated*.
|
||||
> Note that `stop` and `continue` (now `Loop.resume`) are
|
||||
> *deprecated*.
|
||||
|
||||
You can call the function `gcd` defined above using the LIGO compiler
|
||||
like so:
|
||||
@ -135,12 +136,12 @@ let gcd = ((x,y) : (nat, nat)) : nat => {
|
||||
```
|
||||
|
||||
To ease the writing and reading of the iterated functions (here,
|
||||
`iter`), two predefined functions are provided: `Loop.continue` and
|
||||
`iter`), two predefined functions are provided: `Loop.resume` and
|
||||
`Loop.stop`:
|
||||
|
||||
```reasonligo group=b
|
||||
let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) =>
|
||||
if (y == 0n) { Loop.stop ((x,y)); } else { Loop.continue ((y, x mod y)); };
|
||||
if (y == 0n) { Loop.stop ((x,y)); } else { Loop.resume ((y, x mod y)); };
|
||||
|
||||
let gcd = ((x,y) : (nat, nat)) : nat => {
|
||||
let (x,y) = if (x < y) { (y,x); } else { (x,y); };
|
||||
@ -149,7 +150,8 @@ let gcd = ((x,y) : (nat, nat)) : nat => {
|
||||
};
|
||||
```
|
||||
|
||||
> Note that `stop` and `continue` are *deprecated*.
|
||||
> Note that `stop` and `continue` (now `Loop.resume`) are
|
||||
> *deprecated*.
|
||||
|
||||
<!--END_DOCUSAURUS_CODE_TABS-->
|
||||
|
||||
|
@ -395,7 +395,7 @@ module Simplify = struct
|
||||
(* Loop module *)
|
||||
|
||||
| "Loop.fold_while" -> ok C_FOLD_WHILE
|
||||
| "Loop.continue" -> ok C_CONTINUE
|
||||
| "Loop.resume" -> ok C_CONTINUE
|
||||
| "continue" -> ok C_CONTINUE (* Deprecated *)
|
||||
| "Loop.stop" -> ok C_STOP
|
||||
| "stop" -> ok C_STOP (* Deprecated *)
|
||||
@ -404,7 +404,7 @@ module Simplify = struct
|
||||
|
||||
| "assert" -> ok C_ASSERTION
|
||||
|
||||
| _ -> simple_fail "Not a CameLIGO built-in."
|
||||
| _ -> simple_fail "Not a CameLIGO built-in."
|
||||
|
||||
let type_constants = type_constants
|
||||
let type_operators = type_operators
|
||||
|
Loading…
Reference in New Issue
Block a user