1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-12 11:38:08 +00:00

Tweak apply and short-fn docstrings

This commit is contained in:
sogaiu
2025-02-06 22:35:59 +09:00
parent 410f8d69bc
commit 1b6cc023a5
2 changed files with 10 additions and 17 deletions

View File

@@ -2345,17 +2345,11 @@
(defmacro short-fn
```
Shorthand for `fn`. Arguments are given as `$n`, where `n` is the 0-indexed
argument of the function. `$` is also an alias for the first (index 0) argument.
The `$&` symbol will make the anonymous function variadic if it appears in the
body of the function, and can be combined with positional arguments.
Example usage:
(short-fn (+ $ $)) # A function that doubles its arguments.
(short-fn (string $0 $1)) # accepting multiple args.
|(+ $ $) # use pipe reader macro for terse function literals.
|(+ $&) # variadic functions
Shorthand for `fn`. Arguments are given as `$n`, where `n` is the
0-indexed argument of the function. `$` is also an alias for the
first (index 0) argument. The `$&` symbol will make the anonymous
function variadic if it appears in the body of the function, and
can be combined with positional arguments.
```
[arg &opt name]
(var max-param-seen -1)