mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-25 08:53:55 +00:00
More doc-sites for the funct keyword (#963)
This commit is contained in:
parent
a7226b1633
commit
53b5d9c9bd
2 changed files with 6 additions and 6 deletions
|
|
@ -300,7 +300,7 @@ num_total=5,num_positive=3
|
|||
|
||||
## Local variables
|
||||
|
||||
Local variables are similar to out-of-stream variables, except that their extent is limited to the expressions in which they appear (and their basenames can't be computed using square brackets). There are three kinds of local variables: **arguments** to functions/subroutines, **variables bound within for-loops**, and **locals** defined within control blocks. They may be untyped using `var`, or typed using `num`, `int`, `float`, `str`, `bool`, `arr`, and `map`.
|
||||
Local variables are similar to out-of-stream variables, except that their extent is limited to the expressions in which they appear (and their basenames can't be computed using square brackets). There are three kinds of local variables: **arguments** to functions/subroutines, **variables bound within for-loops**, and **locals** defined within control blocks. They may be untyped using `var`, or typed using `num`, `int`, `float`, `str`, `bool`, `arr`, `map`, and `funct`.
|
||||
|
||||
For example:
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ Things which are completely unsurprising, resembling many other languages:
|
|||
|
||||
Things which are perhaps surprising compared to other languages:
|
||||
|
||||
* Type declarations using `var`, or typed using `num`, `int`, `float`, `str`, `arr`, and `bool` are not necessary to declare local variables. Function arguments and variables bound in for-loops over stream records and out-of-stream variables are *implicitly* declared using `var`. (Some examples are shown below.)
|
||||
* Type declarations using `var`, or typed using `num`, `int`, `float`, `str`, `arr`, `bool`, and `funct` are not necessary to declare local variables. Function arguments and variables bound in for-loops over stream records and out-of-stream variables are *implicitly* declared using `var`. (Some examples are shown below.)
|
||||
|
||||
* Type-checking is done at assignment time. For example, `float f = 0` is an error (since `0` is an integer), as is `float f = 0.0; f = 1`. For this reason I prefer to use `num` over `float` in most contexts since `num` encompasses integer and floating-point values. More information is at [Type-checking](reference-dsl-variables.md#type-checking).
|
||||
|
||||
|
|
@ -697,7 +697,7 @@ See [Data-cleaning Examples](data-cleaning-examples.md) for examples of how to u
|
|||
|
||||
### Type-declarations for local variables, function parameter, and function return values
|
||||
|
||||
Local variables can be defined either untyped as in `x = 1`, or typed as in `int x = 1`. Types include **var** (explicitly untyped), **int**, **float**, **num** (int or float), **str**, **bool**, **arr**, and **map**. These optional type declarations are enforced at the time values are assigned to variables: whether at the initial value assignment as in `int x = 1` or in any subsequent assignments to the same variable farther down in the scope.
|
||||
Local variables can be defined either untyped as in `x = 1`, or typed as in `int x = 1`. Types include **var** (explicitly untyped), **int**, **float**, **num** (int or float), **str**, **bool**, **arr**, **map**, and **funct**. These optional type declarations are enforced at the time values are assigned to variables: whether at the initial value assignment as in `int x = 1` or in any subsequent assignments to the same variable farther down in the scope.
|
||||
|
||||
The reason for `num` is that `int` and `float` typedecls are very precise:
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ GENMD-EOF
|
|||
|
||||
## Local variables
|
||||
|
||||
Local variables are similar to out-of-stream variables, except that their extent is limited to the expressions in which they appear (and their basenames can't be computed using square brackets). There are three kinds of local variables: **arguments** to functions/subroutines, **variables bound within for-loops**, and **locals** defined within control blocks. They may be untyped using `var`, or typed using `num`, `int`, `float`, `str`, `bool`, `arr`, and `map`.
|
||||
Local variables are similar to out-of-stream variables, except that their extent is limited to the expressions in which they appear (and their basenames can't be computed using square brackets). There are three kinds of local variables: **arguments** to functions/subroutines, **variables bound within for-loops**, and **locals** defined within control blocks. They may be untyped using `var`, or typed using `num`, `int`, `float`, `str`, `bool`, `arr`, `map`, and `funct`.
|
||||
|
||||
For example:
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ Things which are completely unsurprising, resembling many other languages:
|
|||
|
||||
Things which are perhaps surprising compared to other languages:
|
||||
|
||||
* Type declarations using `var`, or typed using `num`, `int`, `float`, `str`, `arr`, and `bool` are not necessary to declare local variables. Function arguments and variables bound in for-loops over stream records and out-of-stream variables are *implicitly* declared using `var`. (Some examples are shown below.)
|
||||
* Type declarations using `var`, or typed using `num`, `int`, `float`, `str`, `arr`, `bool`, and `funct` are not necessary to declare local variables. Function arguments and variables bound in for-loops over stream records and out-of-stream variables are *implicitly* declared using `var`. (Some examples are shown below.)
|
||||
|
||||
* Type-checking is done at assignment time. For example, `float f = 0` is an error (since `0` is an integer), as is `float f = 0.0; f = 1`. For this reason I prefer to use `num` over `float` in most contexts since `num` encompasses integer and floating-point values. More information is at [Type-checking](reference-dsl-variables.md#type-checking).
|
||||
|
||||
|
|
@ -352,7 +352,7 @@ See [Data-cleaning Examples](data-cleaning-examples.md) for examples of how to u
|
|||
|
||||
### Type-declarations for local variables, function parameter, and function return values
|
||||
|
||||
Local variables can be defined either untyped as in `x = 1`, or typed as in `int x = 1`. Types include **var** (explicitly untyped), **int**, **float**, **num** (int or float), **str**, **bool**, **arr**, and **map**. These optional type declarations are enforced at the time values are assigned to variables: whether at the initial value assignment as in `int x = 1` or in any subsequent assignments to the same variable farther down in the scope.
|
||||
Local variables can be defined either untyped as in `x = 1`, or typed as in `int x = 1`. Types include **var** (explicitly untyped), **int**, **float**, **num** (int or float), **str**, **bool**, **arr**, **map**, and **funct**. These optional type declarations are enforced at the time values are assigned to variables: whether at the initial value assignment as in `int x = 1` or in any subsequent assignments to the same variable farther down in the scope.
|
||||
|
||||
The reason for `num` is that `int` and `float` typedecls are very precise:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue