# HG changeset patch # User Steve Losh # Date 1675906944 18000 # Node ID bfa9e871b3c0aafe14d70c878f283fed69a4e7d9 # Parent 844651032c48b8e14fef42bdb1ce0a3d9c7d6307 Update documentation diff -r 844651032c48 -r bfa9e871b3c0 DOCUMENTATION.markdown --- a/DOCUMENTATION.markdown Wed Feb 08 20:40:55 2023 -0500 +++ b/DOCUMENTATION.markdown Wed Feb 08 20:42:24 2023 -0500 @@ -406,6 +406,12 @@ +### `ENSURE-SLOT-VALUE` (macro) + + (ENSURE-SLOT-VALUE OBJECT SLOT &OPTIONAL DEFAULT) + +Return the `slot-value` of `slot` in `object`, setting it to `default` if unbound. + ## Package `LOSH.CONTROL-FLOW` Utilities for managing control flow. @@ -529,7 +535,7 @@ ### `DO-VECTOR` (macro) - (DO-VECTOR (VAR-OR-VARS VECTOR) + (DO-VECTOR (VAR-OR-VARS VECTOR &KEY (START NIL START?) (END NIL END?)) &BODY BODY) @@ -1134,6 +1140,34 @@ Just evaluate `body` all the time, jesus christ lisp. +### `SCRATCH` (macro) + + (SCRATCH + &BODY + FORMS) + +Evaluate `forms` in an imperative fashion. + + Each expression in `forms` will be evaluated, with the following exceptions: + + * A bare symbol will be bound via (nested) `let` to the next expression. + * `:mv` will bind the next expression (which must be a list of symbols) to the + expression after it with `multiple-value-bind`. + * `:db` will bind the next expression (which must be a valid binding) to the + expression after it with `destructuring-bind`. + + Example: + + (scratch + a 10 + b 20 + c (+ a b) + :mv (d e) (truncate 100 23) + :db (f (g)) (list 100 (list 22)) + (+ a (- b c) d e (* f g))) + + + ## Package `LOSH.FUNCTIONS` Utilities for working with higher-order functions. @@ -1214,6 +1248,15 @@ `commands` must be a string or a sequence of strings. + Example: + + (gnuplot `(("$data" . ,foo-data)) " + @xrfc3339 + set terminal qt + plot $data using 1:2 with linespoints + pause mouse close + ") + ### `GNUPLOT-COMMAND` (function) @@ -2254,6 +2297,17 @@ Utilities for operating on sequences. +### `CHUNK` (function) + + (CHUNK SEQUENCE CHUNK-SIZE) + +Split `sequence` into a list of subsequences of size `chunk-size`. + + The final chunk may be smaller than `chunk-size` if the length of `sequence` + is not evenly divisible by `chunk-size`. + + + ### `DEFINE-SORTING-PREDICATE` (macro) (DEFINE-SORTING-PREDICATE NAME PREDICATE-SPEC &REST MORE-PREDICATE-SPECS) @@ -2483,6 +2537,16 @@ +### `NGRAMS` (function) + + (NGRAMS N SEQUENCE) + +Return a list of the `n`grams of `sequence`. + + The length of `sequence` must be at least `n`. + + + ### `PREFIX-SUMS` (function) (PREFIX-SUMS SEQUENCE &KEY KEY (RESULT-TYPE 'LIST))