Removed `begin` and `end` with curly brackets

parent 64baa609
......@@ -6,7 +6,7 @@ make fib: $ declaration of the `fib` function
(i: () -> int) $ takes a function returning an int with no
$ argument as argument
-> int $ returns a literal int
<- begin $ beginnig of block of instruction
<- { $ beginnig of block of instruction
make a: $ function `a`
(i: () -> int) $ taking an function without argument returning
......@@ -31,4 +31,4 @@ make fib: $ declaration of the `fib` function
<- res(&a, &b, &i); $ returns evaluation of `res`
end; $ end of block of instruction for `fib`
}; $ end of block of instruction for `fib`
......@@ -9,7 +9,7 @@ For the better or the worse, PRAKDA has a unique syntax which allows to create f
make var: () -> int <- Int(5);
#+END_SRC
The ~make~ keyword allows the creation or definition of a function. Its name, beginning with a character and composed of characters or numbers, follows. The colon (~:~) marks the beginning of the arguments. There can be either no arguments, marked with ~()~, or several of them, marked as shown below. The right arrow ~->~ indicates the return type of the function, whereas the left arrow ~<-~ indicates the body of the function. It can either be a one-liner with only one instruction, or it can be a block of instructions surrounded by the keywords ~begin~ and ~end~. Here's an example with a naive Fibonacci function:
The ~make~ keyword allows the creation or definition of a function. Its name, beginning with a character and composed of characters or numbers, follows. The colon (~:~) marks the beginning of the arguments. There can be either no arguments, marked with ~()~, or several of them, marked as shown below. The right arrow ~->~ indicates the return type of the function, whereas the left arrow ~<-~ indicates the body of the function. It can either be a one-liner with only one instruction, or it can be a block of instructions surrounded by curly brackets. Here's an example with a naive Fibonacci function:
#+BEGIN_SRC text -n
$$$
Declaration of the function `fib` which takes either a function returning a
......@@ -19,7 +19,7 @@ The ~make~ keyword allows the creation or definition of a function. Its name, be
(i: () -> int) $ takes a function returning an int with no
$ argument as argument
-> int $ returns a literal int
<- begin $ beginnig of block of instruction
<- { $ beginnig of block of instruction
make a: $ function `a`
(i: () -> int) $ taking an function without argument returning
......@@ -44,7 +44,7 @@ The ~make~ keyword allows the creation or definition of a function. Its name, be
<- res(&a, &b, &i); $ returns evaluation of `res`
end; $ end of block of instruction for `fib`
}; $ end of block of instruction for `fib`
#+END_SRC
A function can be called either by just typing its name if it has no arguments, as we can see on the calls on ~i~ above, or by typing its name then parenthesis with its arguments inside as we can see with the calls of ~a~, ~b~ and ~res~. A function can be passed as arguments without being evaluated by adding the symbol ~&~ before the name of the function, as we can see on the second to last line above.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment