diff options
| author | 2024-12-26 18:04:58 -0500 | |
|---|---|---|
| committer | 2024-12-26 18:04:58 -0500 | |
| commit | bfefae4c3ffbfe229e0cf68f6317909fe16b50a5 (patch) | |
| tree | d347f0dcecf9259c4f6cb03fc1e7a9bd5db0df60 /doc | |
| parent | cond-thunk (diff) | |
values lib
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/mcgoron.cond-thunk.values.scm | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/mcgoron.cond-thunk.values.scm b/doc/mcgoron.cond-thunk.values.scm new file mode 100644 index 0000000..5f2265f --- /dev/null +++ b/doc/mcgoron.cond-thunk.values.scm @@ -0,0 +1,54 @@ +(((name . "after") + (signature syntax-rules (when let =>) (after (clause ...) body ...)) + (subsigs + (clause (pattern + ((when conditional)) + ((let value => formal))))) + (desc " +For each clause, + +* If `clause` is `when conditional`, then `conditional` is evaluated. If + `conditional` is false, then the `after` expression returns `#f`. + Otherwise the rest of the clauses are executed. +* If `clause` is `let value => formal`, then `value` is evaluated. If + `value` returns no values, then the `after` expression returns `#f`. + Otherwise, the values returned are bound to `formal` in the next clauses + and in the body. + +Once all clauses succeed, the `after` clause returns a thunk containing +body. The free variables bound in and surrounding the `after` expression +are captured in the thunk.")) + ((name . "cond-values") + (signature syntax-rules () (cond-values clauses ...)) + (desc " +A wrapper around `cond-thunk` that returns no values instead of `#f` +when all clauses are exhausted. This is intended for destructuring +procedures used by `after`. See `cond-thunk` for more details.")) + ((name . "pair=>") + (signature lambda (x) => (or (values * *) (values))) + (tags destructuring) + (desc " +If `x` is a pair, return its car and cdr. Otherwise return no values.")) + ((name . "length-at-least=>") + (signature lambda (whole-list (integer? num)) *) + (tags destructuring) + (desc " +* It is an error if `num` is not a positive integer. + +If `whole-list` is a proper or improper list of length at least `num`, +then `num + 1` values are delivered: the first `num` elements and a +final element with the rest of the list.")) + ((name. "length=>") + (signature lambda (whole-list (integer? num)) *) + (tags destructuring) + (desc " +* It is an error if `num` is not a positive integer. + +If `whole-list` is a proper list of length `num`, then each element of the +list is returned as values.")) + ((name . "apply-after") + (signature syntax-rules () ((_ producer consumer))) + (desc " +Evaluates `producer`. If `producer` evaluates to at least one value, then +return a thunk that, when called, tail-calls `consumer` with the values +that `producer` produced. Otherwise, return `#f~.")))
\ No newline at end of file |
