diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-29 14:19:44 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-07 21:17:22 +0200 |
commit | a4178c29f7151a27ef5a2de0cea31d0c9c51ac57 (patch) | |
tree | 6c1755c496ce73828c439f35287018074ffb3b42 /doc | |
parent | Major work on c parser. (diff) | |
download | calp-a4178c29f7151a27ef5a2de0cea31d0c9c51ac57.tar.gz calp-a4178c29f7151a27ef5a2de0cea31d0c9c51ac57.tar.xz |
Add split-by-one-of.
A rather peculiar procedure, but "needed" to implement order of
operations on a flat list.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ref/guile/util.texi | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/ref/guile/util.texi b/doc/ref/guile/util.texi index 32df5fce..222b59c5 100644 --- a/doc/ref/guile/util.texi +++ b/doc/ref/guile/util.texi @@ -198,6 +198,27 @@ Split a list into sub-lists on @var{element} @end lisp @end defun +@defun split-by-one-of lst items +Like split-by, but takes a list of delimiters. +Returns a list where the first element is everything before the first +delimiter, and the remaining elements is the splitting delimiter +consed with everything until the next delimiter. + +@lisp +(split-by-one-of '() '(+))) +⇒ (()) + +(split-by-one-of '(1 + 2) '(/)) +⇒ ((1 + 2)) + +(split-by-one-of '(1 + 2 - 3) '(+ -)) +⇒ ((1) (+ 2) (- 3)) + +(split-by-one-of '(1 + 2 * 3 + 4) '(*)) +⇒ ((1 + 2) (* 3 + 4)) +@end lisp +@end defun + @defun span-upto count predicate list Simar to span from srfi-1, but never takes more than |