summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md28
1 files changed, 18 insertions, 10 deletions
diff --git a/README.md b/README.md
index 30189c2..caa7d2d 100644
--- a/README.md
+++ b/README.md
@@ -9,31 +9,39 @@ to a `lambda` expressions, which wraps around its arguments.
This `lambda` expression calls the function FN with arguments
ARGS and returns its value. Its own arguments are derived from
-symbols found in ARGS. Each symbol from `%1` through `%9`, which
-appears in ARGS, is treated as a positional argument. Missing
-arguments are named `_%N`, which keeps the byte-compiler quiet.
-In place of `%1` the shorthand `%` can be used, but only one of
-these two can appear in ARGS. `%*` represents extra `&rest`
-arguments.
+symbols found in ARGS.
+
+Each symbol from `%1` through `%9`, which appears in ARGS,
+specifies an argument. Each symbol from `&1` through `&9`, which
+appears in ARGS, specifies an optional argument. All arguments
+following an optional argument have to be optional as well, thus
+their names have to begin with `&`. Symbol `&*` specifies extra
+(`&rest`) arguments.
+
+Instead of `%1`, the shorthand `%` can be used; but that should
+only be done if it is the only argument, and using both `%1` and
+`%` is not allowed. Likewise `&` can be substituted for `&1`.
+Finally, for backward compatibility, `%*` can be used in place
+of `&*`, but only if there are no optional arguments.
Instead of:
```elisp
-(lambda (a _ c &rest d)
+(lambda (a _ &optional c &rest d)
(foo a (bar c) d))
```
you can use this macro and write:
```elisp
-(##foo % (bar %3) %*)
+(##foo %1 (bar &3) &*)
```
which expands to:
```elisp
-(lambda (% _%2 %3 &rest %*)
- (foo % (bar %3) %*))
+(lambda (%1 _%2 &optional &3 &rest %*)
+ (foo %1 (bar &3) %*))
```
The name `##` was choosen because that allows (optionally)