🐐 First order functions
This commit is contained in:
22
README.md
22
README.md
@@ -244,6 +244,28 @@ Calling a function is done with the `INVOCA` keyword.
|
||||
> CXXI
|
||||
```
|
||||
|
||||
## First-class functions
|
||||
Functions are first-class values in CENTVRION. They can be assigned to variables, passed as arguments, returned from functions, and stored in arrays or dicts.
|
||||
|
||||
Anonymous functions are created with the `FVNCTIO` keyword:
|
||||
|
||||

|
||||
|
||||
```
|
||||
> XIV
|
||||
```
|
||||
|
||||
`INVOCA` accepts any expression as the callee, not just a name:
|
||||
|
||||

|
||||
```
|
||||
> VI
|
||||
> VI
|
||||
> XVI
|
||||
```
|
||||
|
||||
Note: CENTVRION does **not** have closures. When a function is called, it receives a copy of the *caller's* scope, not the scope where it was defined. Variables from a function's definition site are only available if they also exist in the caller's scope at call time.
|
||||
|
||||
## Built-ins
|
||||
### DICE
|
||||
`DICE(value, ...)`
|
||||
|
||||
Reference in New Issue
Block a user