@@ -122,10 +122,14 @@ Parameter types are
122
122
* expression (only macro can treat this)
123
123
124
124
But all values must be able to be serialized to JSON. Because AST of whole
125
- process is serialized and saved as a "transaction log file". The process can be
126
- rolled back, when an error occur while the process, or user send SIGINT signal,
127
- or ` volt history undo ` command is executed. The transaction log file does not
128
- have ID but the saved directory ` {id} ` does:
125
+ process is serialized and saved as a "transaction log file".
126
+
127
+ NOTE: All macros has ` $ ` prefixed name for readability.
128
+ Macros are not saved in transaction log (expanded before saving).
129
+
130
+ The process can be rolled back, when an error occur while the process, or user
131
+ send SIGINT signal, or ` volt history undo ` command is executed. The transaction
132
+ log file does not have ID but the saved directory ` {id} ` does:
129
133
130
134
```
131
135
$VOLTPATH/trx/{id}/log.json
@@ -367,10 +371,7 @@ As the above signature shows, operators must take care the following points:
367
371
368
372
TODO: Move to Godoc.
369
373
370
- ### Basic macros
371
-
372
- All macros has `$` prefixed name for readability.
373
- Macros are not saved in transaction log (expanded before saving).
374
+ ### Basic operators
374
375
375
376
* `["$array", v1 Value, ...] Array`
376
377
* Returns inverse expression of given expression.
@@ -390,20 +391,31 @@ Macros are not saved in transaction log (expanded before saving).
390
391
instead of its expression.
391
392
* See `repos/git/fetch`, `repos/git/update` for concrete example.
392
393
393
- ### Basic operators
394
+ * `["fn", [args ...[]string], body Expr[R]]R`
395
+ * Returns a lambda with `arity` number arguments and `body` expression.
396
+ * e.g.
397
+ * `["fn", [], ["lockjson/write"]]`
398
+ * see below
399
+
400
+ ```json
401
+ [["fn", [["path", "string"], ["profiles", ["array", "string"]]],
402
+ ["lockjson/add", ["repos/get", ["arg", "path"]], ["arg", "profiles"]]],
403
+ "github.com/tyru/caw.vim",
404
+ ["$array", "default"]]
405
+ ```
394
406
395
- * `["$label", linenum: number, tmpl string, expr Expr[* => R]] R`
407
+ * `["$label", linenum number, tmpl string, expr Expr[R]] R`
396
408
* `["$label", linenum, tmpl, expr]` expands to
397
409
`["label", linenum, tmpl, ["fn", [] expr]]`
398
410
399
- * `["label", linenum: number, tmpl string, thunk Func[* => R]] R`
411
+ * `["label", linenum number, tmpl string, thunk Func[R]] R`
400
412
* Render `tmpl` by text/template to `linenum` line (1-origin).
401
413
Returns the evaluated value of `thunk`.
402
414
* e.g.
403
415
* `["$invert", ["label", linenum, "msg", thunk]]` = `["label", ["$invert", linenum], "revert: \"msg\"", ["$invert", thunk]]`
404
416
* See `Label examples` section for more details
405
417
406
- * `["$do", expr1 Expr[* => R1], ..., expr_last Expr[* => R2]] R2`
418
+ * `["$do", expr1 Expr[R1], ..., expr_last Expr[R2]] R2`
407
419
* `["$do", expr1, expr2]` expands to
408
420
`["do", ["fn", [], expr1], ["fn", [], expr2]]`
409
421
@@ -414,11 +426,11 @@ Macros are not saved in transaction log (expanded before saving).
414
426
* `["$invert", ["do", thunk1, thunk2]]` = `["do", ["$invert", thunk1], ["$invert", thunk2]]`
415
427
* Note that the arguments are reversed.
416
428
417
- * `["$parallel", expr1 Expr[* => R1], ..., expr_last Expr[* => R2]] R2`
429
+ * `["$parallel", expr1 Expr[R1], ..., expr_last Expr[R2]] R2`
418
430
* `["$parallel", expr1, expr2]` expands to
419
431
`["parallel", ["fn", [], expr1], ["fn", [], expr2]]`
420
432
421
- * `["parallel", thunk1 Func[* => R1], ..., thunk_last Func[* => R2]] R2`
433
+ * `["parallel", thunk1 Func[R1], ..., thunk_last Func[R2]] R2`
422
434
* Executes multiple lambdas in parallel.
423
435
* Returns the evaluated value of the last lambda.
424
436
* e.g.
@@ -549,7 +561,7 @@ Macros are not saved in transaction log (expanded before saving).
549
561
550
562
### Vim directory operators
551
563
552
- * ` [" vimdir/with-install" , paths " all" | []ReposPath , expr Expr [* => R ]] R `
564
+ * ` [" vimdir/with-install" , paths " all" | []ReposPath , expr Expr [R]] R `
553
565
* ` paths` is the list of repositories to build after ` expr` is executed.
554
566
* ` " all" ` means all repositories of current profile.
555
567
* e.g.
0 commit comments