| `??` | `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.