Skip to content
Snippets Groups Projects
Commit d95b16c0 authored by nanocryk's avatar nanocryk
Browse files

typo

parent 2a1caa3c
Branches
No related tags found
1 merge request!6WIP: RFC 5 : New Scalable Blockchain Protocol
......@@ -455,7 +455,7 @@ To make it more readable and to express it's an array, we also write it as :
[0 1 2] :: [Int]
```
A function like `map` take arrays and partial functions as parameters. Its signature is :
A function like `map` take an array and a function as parameters. Its signature is :
```txt
map :: [a] -> (a -> b) -> [b]
......@@ -538,7 +538,7 @@ Then, each fonction contains on of these opcodes.
| `02` | `step :: begin:Int -> step:Int -> end:Int -> [Int]` | Returns an array of numbers from `begin` to `end` (excluded) with a step of `step`.
| | |
| | | **Function operations**
| `??` | `if :: condition:Bool -> yes:a) -> no:a) -> a` | If `condition` is `true`, returns `yes`, `no` otherwise.
| `??` | `if :: condition:Bool -> yes:a -> no:a -> a` | If `condition` is `true`, returns `yes`, `no` otherwise.
| `??` | `try :: fun:a!? -> (success:a -> b) -> (failure: Bool -> b) -> result:b` | Try `fun`. If it doesn't panic, calls `success` with returned value, otherwise calls `failure` with the panic boolean type. It returns the value returned by `success` or `failure`.
| `??` | `fold :: array:[a] -> init:b -> fun:(acc:b -> item:a -> b) -> b` | Use `init` as first value of an accumulator, then for each item the accumator is passed to `fun`, and the return value of fun is used as the new value of the accumulator. When the array access panic (out of bound), the final value of the accumulator is returned.
| `??` | `map :: array:[a] -> fun:(item:a -> b) -> [b]` | For each `item` in `array`, calls `fun item`.
......@@ -548,7 +548,7 @@ Then, each fonction contains on of these opcodes.
| `??` | `binarop :: type:OpType -> op:BinaryOp -> x:V -> y:V -> V` | Performs a binary operation on `x` and `y`. `type` specify which algorithm to use (integer operation, interger with power of 10 operation, etc); and `op` specify the binary operation to apply.
| | |
| | | **Arrays operations**
| `??` | `value_to_bytes :: V -> [V])` | Convert a value into a array of individual bytes.
| `??` | `value_to_bytes :: V -> [V]` | Convert a value into a array of individual bytes.
| `??` | `bytes_to_value :: [V] -> V` | Convert a bytes array into an unique value.
| `??` | `split :: array:[a] -> lenghts:[Int] -> [[a]]` | Split an array in multiple parts of `lengths` lengths, the last part containing the remaining items. When spliting out of bounds, empty arrays are returned.
| `??` | `merge :: parts:[[a]] -> [a]` | Merge all parts into one array.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment