aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorNicolas Petton2015-05-05 22:10:32 +0200
committerNicolas Petton2015-05-05 22:10:32 +0200
commit4ac426a1b90912ea947d46a57b6fcbbbf7586da1 (patch)
treebbf748a53aca52aeac72df288e9cfbac3b951580 /doc
parent0508aa26705b3507d9afac54ada4eac47f8cf8a5 (diff)
parent8cb4b4f98aa2758a016df25e39ff48cf132ed39c (diff)
downloademacs-4ac426a1b90912ea947d46a57b6fcbbbf7586da1.tar.gz
emacs-4ac426a1b90912ea947d46a57b6fcbbbf7586da1.zip
Merge branch 'seq-let'
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/sequences.texi38
1 files changed, 37 insertions, 1 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index b48fae4741f..1166ef8b36f 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -413,7 +413,7 @@ but their relative order is also preserved:
413 (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")] 413 (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]
414@end group 414@end group
415@end example 415@end example
416 416
417@xref{Sorting}, for more functions that perform sorting. 417@xref{Sorting}, for more functions that perform sorting.
418See @code{documentation} in @ref{Accessing Documentation}, for a 418See @code{documentation} in @ref{Accessing Documentation}, for a
419useful example of @code{sort}. 419useful example of @code{sort}.
@@ -797,6 +797,42 @@ vector or string (@pxref{Iteration} for more information about the
797@code{dolist} macro). This is primarily useful for side-effects. 797@code{dolist} macro). This is primarily useful for side-effects.
798@end defmac 798@end defmac
799 799
800@defmac seq-let arguments sequense body@dots{}
801@cindex sequence destructuring
802 This macro binds the variables in defined in the sequence
803@var{arguments} to the elements of the sequence @var{sequence}.
804@var{arguments} can itself include sequences allowing for nested
805destructuring.
806
807The @var{arguments} sequence can also include the `&rest' marker
808followed by a variable name to be bound to the rest of
809@code{sequence}.
810
811@example
812@group
813(seq-let [first second] [1 2 3 4]
814 (list first second))
815@result{} (1 2)
816@end group
817@group
818(seq-let (_ a _ b) '(1 2 3 4)
819 (list a b))
820@result{} (2 4)
821@end group
822@group
823(seq-let [a [b [c]]] [1 [2 [3]]]
824 (list a b c))
825@result{} (1 2 3)
826@end group
827@group
828(seq-let [a b &rest others] [1 2 3 4]
829 others)
830@end group
831@result{} [3 4]
832@end example
833@end defmac
834
835
800@node Arrays 836@node Arrays
801@section Arrays 837@section Arrays
802@cindex array 838@cindex array