review 1
This commit is contained in:
parent
abbc20459c
commit
dbb6fbd8e6
@ -301,13 +301,13 @@ gitlab-pages/docs/language-basics/src/functions/incr_map.religo incr_map
|
||||
|
||||
## Recursive function
|
||||
|
||||
LIGO function are not recursive by default, the user need to indicate that the function is recursive.
|
||||
LIGO functions are not recursive by default, the user need to indicate that the function is recursive.
|
||||
|
||||
At the moment, recursive function are limited to one (possibly tupled) parameter and recursion is
|
||||
limited to tail recursion (i.e the recursive call should be the last expression of the function)
|
||||
|
||||
<Syntax syntax="pascaligo">
|
||||
In PascaLigo recursive funciton are defined using the "recursive" keyword
|
||||
In PascaLigo recursive functions are defined using the "recursive" keyword
|
||||
|
||||
```pascaligo group=d
|
||||
recursive function sum (const n : int; const acc: int) : int is
|
||||
@ -318,7 +318,7 @@ recursive function fibo (const n: int; const n_1: int; const n_0 :int) : int is
|
||||
```
|
||||
</Syntax>
|
||||
<Syntax syntax="cameligo">
|
||||
In CameLigo recursive funciton are defined using the "rec" keyword
|
||||
In CameLigo recursive functions are defined using the "rec" keyword
|
||||
|
||||
```cameligo group=d
|
||||
let rec sum ((n,acc):int * int) : int =
|
||||
@ -329,7 +329,7 @@ let rec fibo ((n,n_1,n_0):int*int*int) : int =
|
||||
```
|
||||
</Syntax>
|
||||
<Syntax syntax="reasonligo">
|
||||
In ReasonLigo recursive funciton are defined using the "rec" keyword
|
||||
In ReasonLigo recursive functions are defined using the "rec" keyword
|
||||
|
||||
```reasonligo group=d
|
||||
let rec sum = ((n, acc) : (int,int)): int =>
|
||||
|
@ -203,7 +203,7 @@ field_decl:
|
||||
and value = {field_name=$1; colon=$2; field_type=$3}
|
||||
in {region; value} }
|
||||
|
||||
(* Top-level non-eecursive definitions *)
|
||||
(* Top-level definitions *)
|
||||
|
||||
let_declaration:
|
||||
"let" ioption("rec") let_binding seq(Attr) {
|
||||
|
@ -261,7 +261,7 @@ field_decl:
|
||||
and value = {field_name=$1; colon=$2; field_type=$3}
|
||||
in {region; value} }
|
||||
|
||||
(* Top-level non-recursive definitions *)
|
||||
(* Top-level definitions *)
|
||||
|
||||
let_declaration:
|
||||
seq(Attr) "let" ioption("rec") let_binding {
|
||||
|
@ -73,7 +73,7 @@ module Errors = struct
|
||||
let untyped_recursive_function var =
|
||||
let title () = "" in
|
||||
let message () =
|
||||
Format.asprintf "\nUntyped recursive function \
|
||||
Format.asprintf "\nUntyped recursive functions \
|
||||
are not supported yet.\n" in
|
||||
let param_loc = var.Region.region in
|
||||
let data = [
|
||||
|
Loading…
Reference in New Issue
Block a user