Merge branch 'docs/front-page-example-update' into 'dev'
Fix examples on front page of ligolang.org, add reminder to change in future See merge request ligolang/ligo!345
This commit is contained in:
commit
56135ac711
@ -24,51 +24,51 @@ ${pre}`;
|
||||
const CAMELIGO_EXAMPLE = `${pre}ocaml
|
||||
type storage = int
|
||||
|
||||
(* variant defining pseudo multi-entrypoint
|
||||
actions *)
|
||||
(* variant defining pseudo multi-entrypoint actions *)
|
||||
|
||||
type action =
|
||||
| Increment of int
|
||||
| Decrement of int
|
||||
| Increment of int
|
||||
| Decrement of int
|
||||
|
||||
let add (a: int) (b: int): int = a + b
|
||||
let add (a: int) (b: int) : int = a + b
|
||||
let sub (a: int) (b: int) : int = a - b
|
||||
|
||||
let subtract (a: int) (b: int): int = a - b
|
||||
(* real entrypoint that re-routes the flow based on the action provided *)
|
||||
|
||||
(* real entrypoint that re-routes the flow
|
||||
based on the action provided *)
|
||||
let%entry main(p : action) storage =
|
||||
let storage =
|
||||
match p with
|
||||
| Increment n -> add storage n
|
||||
| Decrement n -> subtract storage n
|
||||
in (([] : operation list), storage)
|
||||
let main (p,s: action * storage) =
|
||||
let storage =
|
||||
match p with
|
||||
| Increment n -> add s n
|
||||
| Decrement n -> sub s n
|
||||
in ([] : operation list), storage
|
||||
${pre}`;
|
||||
|
||||
|
||||
const REASONLIGO_EXAMPLE = `${pre}reasonligo
|
||||
type storage = int;
|
||||
|
||||
/* variant defining pseudo multi-entrypoint
|
||||
actions */
|
||||
/* variant defining pseudo multi-entrypoint actions */
|
||||
|
||||
type action =
|
||||
| Increment(int)
|
||||
| Decrement(int);
|
||||
|
||||
let add = (a: int, b: int): int => a + b;
|
||||
let sub = (a: int, b: int): int => a - b;
|
||||
|
||||
let subtract = (a: int, b: int): int => a - b;
|
||||
/* real entrypoint that re-routes the flow based on the action provided */
|
||||
|
||||
/* real entrypoint that re-routes the flow
|
||||
based on the action provided */
|
||||
let main = (p: action, storage) => {
|
||||
let main2 = (p: action, storage) => {
|
||||
let storage =
|
||||
switch (p) {
|
||||
| Increment(n) => add(storage, n)
|
||||
| Decrement(n) => subtract(storage, n)
|
||||
| Decrement(n) => sub(storage, n)
|
||||
};
|
||||
([]: list(operation), storage);
|
||||
};
|
||||
|
||||
let main = (x: (action, storage)) => main2(x[0],x[1]);
|
||||
|
||||
${pre}`;
|
||||
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
(* IF YOU CHANGE THIS, CHANGE THE EXAMPLE ON THE FRONT PAGE OF THE WEBSITE *)
|
||||
|
||||
type storage = int
|
||||
|
||||
(* variant defining pseudo multi-entrypoint actions *)
|
||||
@ -11,9 +13,11 @@ let sub (a: int) (b: int) : int = a - b
|
||||
|
||||
(* real entrypoint that re-routes the flow based on the action provided *)
|
||||
|
||||
let main (ps: action * storage) =
|
||||
let main (p,s: action * storage) =
|
||||
let storage =
|
||||
match ps.0 with
|
||||
| Increment n -> add ps.1 n
|
||||
| Decrement n -> sub ps.1 n
|
||||
match p with
|
||||
| Increment n -> add s n
|
||||
| Decrement n -> sub s n
|
||||
in ([] : operation list), storage
|
||||
|
||||
(* IF YOU CHANGE THIS, CHANGE THE EXAMPLE ON THE FRONT PAGE OF THE WEBSITE *)
|
||||
|
@ -1,3 +1,5 @@
|
||||
(* IF YOU CHANGE THIS, CHANGE THE EXAMPLE ON THE FRONT PAGE OF THE WEBSITE *)
|
||||
|
||||
type storage = int;
|
||||
|
||||
/* variant defining pseudo multi-entrypoint actions */
|
||||
@ -21,3 +23,5 @@ let main2 = (p: action, storage) => {
|
||||
};
|
||||
|
||||
let main = (x: (action, storage)) => main2(x[0],x[1]);
|
||||
|
||||
(* IF YOU CHANGE THIS, CHANGE THE EXAMPLE ON THE FRONT PAGE OF THE WEBSITE *)
|
||||
|
Loading…
Reference in New Issue
Block a user