guile-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]