summaryrefslogtreecommitdiff
path: root/doc/ref/api-compound.texi
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-17 16:07:00 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-17 16:14:02 +0100
commit44cd55752aad2a69e1583a2cb37c3b98c5c44ad3 (patch)
treec44c3bac2afb5731a12246c0382312290c526619 /doc/ref/api-compound.texi
parent67768115d7faa8c9da63a6b5c347adab107403d0 (diff)
downloadguile-44cd55752aad2a69e1583a2cb37c3b98c5c44ad3.tar.gz
doc: Strengthen the case for pattern matching.
* doc/ref/api-compound.texi (Pairs): Warn against `cadr' & co., and add a link to "Pattern Matching". * doc/ref/match.texi (Pattern Matching): Add example with nested lists. Add paragraph comparing `match' expressions and hand-written code.
Diffstat (limited to 'doc/ref/api-compound.texi')
-rw-r--r--doc/ref/api-compound.texi12
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/ref/api-compound.texi b/doc/ref/api-compound.texi
index 27dbcbf53..379ae808a 100644
--- a/doc/ref/api-compound.texi
+++ b/doc/ref/api-compound.texi
@@ -105,10 +105,14 @@ Return 1 when @var{x} is a pair; otherwise return 0.
The two parts of a pair are traditionally called @dfn{car} and
@dfn{cdr}. They can be retrieved with procedures of the same name
(@code{car} and @code{cdr}), and can be modified with the procedures
-@code{set-car!} and @code{set-cdr!}. Since a very common operation in
-Scheme programs is to access the car of a car of a pair, or the car of
-the cdr of a pair, etc., the procedures called @code{caar},
-@code{cadr} and so on are also predefined.
+@code{set-car!} and @code{set-cdr!}.
+
+Since a very common operation in Scheme programs is to access the car of
+a car of a pair, or the car of the cdr of a pair, etc., the procedures
+called @code{caar}, @code{cadr} and so on are also predefined. However,
+using these procedures is often detrimental to readability, and
+error-prone. Thus, accessing the contents of a list is usually better
+achieved using pattern matching techniques (@pxref{Pattern Matching}).
@rnindex car
@rnindex cdr