Function types (#6891)
* Change Fn to fn for function types Signed-off-by: Nick Cameron <nrc@ncameron.org> * Support args and return types in function types Signed-off-by: Nick Cameron <nrc@ncameron.org> * Use fancy function types in the docs Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -10,7 +10,7 @@ Apply a function to every element of a list.
|
||||
```kcl
|
||||
map(
|
||||
@array: [any],
|
||||
f: Fn,
|
||||
f: fn(any): any,
|
||||
): [any]
|
||||
```
|
||||
|
||||
@ -22,7 +22,7 @@ Given a list like `[a, b, c]`, and a function like `f`, returns
|
||||
| Name | Type | Description | Required |
|
||||
|----------|------|-------------|----------|
|
||||
| `array` | [`[any]`](/docs/kcl-std/types/std-types-any) | Input array. The output array is this input array, but every element has had the function `f` run on it. | Yes |
|
||||
| `f` | [`Fn`](/docs/kcl-std/types/std-types-Fn) | A function. The output array is just the input array, but `f` has been run on every item. | Yes |
|
||||
| `f` | [`fn(any): any`](/docs/kcl-std/types/std-types-fn) | A function. The output array is just the input array, but `f` has been run on every item. | Yes |
|
||||
|
||||
### Returns
|
||||
|
||||
|
Reference in New Issue
Block a user