From b27225b2399eda2e9c40fb8c602a03cb9d8d5fa7 Mon Sep 17 00:00:00 2001 From: Tim Bradshaw Date: Tue, 11 Jun 2024 14:31:27 +0100 Subject: [PATCH] utilities: has thunk, thunk*, some documentation --- README.md | 14 ++++++++++++++ VERSION | 2 +- utilities.lisp | 21 ++++++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ebc8ca..d2a747d 100644 --- a/README.md +++ b/README.md @@ -2435,6 +2435,20 @@ Logging to pathnames rather than explicitly-managed streams may be a little slow ### Package, module `slog` lives in and provides `:org.tfeb.hax.slog`. +## Utilities +This is used both by other hax and by other code I've written. Things in this system *may not be stable*: it should be considered mostly-internal. However, changes to it *are* reflected in the version number of things, since other systems can depend on things in it. + +Here is what it currently provides. + +- `parse-docstring-body` parses the body of a function with possible documentation and declarations into three values: docstring, list of declarations and remaining forms. +- `parse-simple-body` is like `parse-docstring-body` but it does not handle docstrings & only returns two values. +- `with-names` binds variables to uninterned symbols with the same name by default: `(with-names () ...)`will bind `` to a fresh uninterned symbol with name `""`. `(with-names (( foo)) ...)` will bind `` to a fresh uninterned symbol with name `"FOO"`. +- `thunk` makes anonymous functions with no arguments: `(thunk ...)` is `(lambda () ...)`. +- `thunk*` makes anonymous functions which take an arbitrary number of arguments and ignore them all. + +### Package, module +The utilities live in and provide `:org.tfeb.hax.utilities`. + --- The TFEB.ORG Lisp hax are copyright 1989-2024 Tim Bradshaw. See `LICENSE` for the license. diff --git a/VERSION b/VERSION index 6d28907..acd405b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.5.0 +8.6.0 diff --git a/utilities.lisp b/utilities.lisp index 5165c5d..b812fe7 100644 --- a/utilities.lisp +++ b/utilities.lisp @@ -6,7 +6,9 @@ (:export #:parse-docstring-body #:parse-simple-body - #:with-names)) + #:with-names + #:thunk + #:thunk*)) (in-package :org.tfeb.hax.utilities) @@ -51,3 +53,20 @@ Optionally you can specify the name by giving a clause as (var (make-symbol ""))) + `(lambda (&rest ,) + (declare (dynamic-extent ,) + (ignore ,)) + ,@body)))