c2970d9e6ea7
Merge
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Tue, 14 Dec 2021 19:12:33 -0500 |
parents | 95393d6a5226 (diff) 656f2f6975bc (current diff) |
children | 461876acdff5 |
branches/tags | (none) |
files | src/iterate.lisp |
Changes
--- a/DOCUMENTATION.markdown Tue Dec 14 19:10:21 2021 -0500 +++ b/DOCUMENTATION.markdown Tue Dec 14 19:12:33 2021 -0500 @@ -1580,6 +1580,16 @@ Sugar for `(if-first-time expr nil)`. +### `WITH-RESULT` (macro) + + (WITH-RESULT SYMBOL = EXPR) + +Bind `expr` to symbol using `with`, and return it at the end. + + Equivalent to `(progn (with symbol = expr) (returning expr))`. + + + ## Package `LOSH.LISTS` Utilities for operating on lists. @@ -2594,7 +2604,7 @@ ### `PBCOPY` (function) - (PBCOPY OBJECT) + (PBCOPY &OPTIONAL (OBJECT *)) `pbcopy` the `aesthetic-string` of `object`.
--- a/src/iterate.lisp Tue Dec 14 19:10:21 2021 -0500 +++ b/src/iterate.lisp Tue Dec 14 19:12:33 2021 -0500 @@ -983,6 +983,16 @@ " `(finally (return (values ,@values)))) +(defmacro with-result (symbol = expr) + "Bind `expr` to symbol using `with`, and return it at the end. + + Equivalent to `(progn (with symbol = expr) (returning expr))`. + + " + (assert (eql = '=)) + `(progn (with ,symbol = ,expr) + (returning ,symbol))) + (defmacro-driver (FOR var-or-vars MATCHING regex AGAINST string &optional OVERLAP overlap? START start END end) "Iterate over the matches of `regex` in `string`, binding `var-or-vars`.