[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 3/6] docs/match: add reverse nested list example
From: |
Blake Shaw |
Subject: |
[PATCH v1 3/6] docs/match: add reverse nested list example |
Date: |
Fri, 27 Jan 2023 01:57:58 +0700 |
---
doc/ref/match.texi | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/doc/ref/match.texi b/doc/ref/match.texi
index c5017e1a5..567146a35 100644
--- a/doc/ref/match.texi
+++ b/doc/ref/match.texi
@@ -112,6 +112,13 @@ extract the elements that make it up.
@result{} ((1 . b) (2 . d) (3 . f))
@end example
+@example
+(match '(((a b c) e f g) 1 2 3)
+ ((((head ...) . rest) tails ...)
+ (acons tails head rest )))
+@result {} (((1 2 3) a b c) e f g)
+@end example
+
Patterns can represent any Scheme object: lists, strings, symbols,
records, etc.
@@ -135,8 +142,7 @@ the corresponding elements of the object.
(match m
((e) e)
((e1 e2 es ...)
- (acons e1 e2
- (re es)))))
+ (acons e1 e2 (re es)))))
@result{} ((a . b) (c . d) (e . f) (g . h) . i)
@end example
--
2.39.1
[PATCH v1 3/6] docs/match: add reverse nested list example,
Blake Shaw <=
[PATCH v1 6/6] docs/match:style reviewing with pdf, adding newlines, Blake Shaw, 2023/01/26
[PATCH v1 4/6] docs/match: match-let* unwrap example, Blake Shaw, 2023/01/26
[PATCH v1 5/6] docs/fixup: @cindex was in the wrong place, Blake Shaw, 2023/01/26
Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Maxime Devos, 2023/01/28
Re: [PATCH v1 1/6] docs/match: add pattern matching examples, Maxime Devos, 2023/01/28