aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorNicolas Petton2015-04-15 00:33:27 +0200
committerNicolas Petton2015-04-15 01:55:03 +0200
commit17d667b3876920652152baa4eab24134940a0f30 (patch)
treee7c8dcebf8bfc976e7212c84dc54b53ae3ced477 /doc/lispref
parent4191e54fc63be623b3a25081ab9fe03d28615fea (diff)
downloademacs-17d667b3876920652152baa4eab24134940a0f30.tar.gz
emacs-17d667b3876920652152baa4eab24134940a0f30.zip
Add seq-intersection and seq-difference to the seq library
* lisp/emacs-lisp/seq.el (seq-intersection, seq-difference): New functions. * test/automated/seq-tests.el: Add tests for seq-intersection and seq-difference. * doc/lispref/sequences.texi: Add documentation for seq-intersection and seq-difference.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/sequences.texi30
1 files changed, 29 insertions, 1 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 1af353590cf..334b3478cb6 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -723,6 +723,35 @@ contain less elements than @var{n}. @var{n} must be an integer. If
723@end example 723@end example
724@end defun 724@end defun
725 725
726@defun seq-intersection sequence1 sequence2 &optional function
727 This function returns a list of the elements that appear both in
728@var{sequence1} and @var{sequence2}. If the optional argument
729@var{function} is non-@code{nil}, it is a function of two arguments to
730use to compare elements instead of the default @code{equal}.
731
732@example
733@group
734(seq-intersection [2 3 4 5] [1 3 5 6 7])
735@result {} (3 5)
736@end group
737@end example
738@end defun
739
740
741@defun seq-difference sequence1 sequence2 &optional function
742 This function returns a list of the elements that appear in
743@var{sequence1} but not in @var{sequence2}. If the optional argument
744@var{function} is non-@code{nil}, it is a function of two arguments to
745use to compare elements instead of the default @code{equal}.
746
747@example
748@group
749(seq-difference '(2 3 4 5) [1 3 5 6 7])
750@result {} (2 4)
751@end group
752@end example
753@end defun
754
726@defun seq-group-by function sequence 755@defun seq-group-by function sequence
727 This function separates the elements of @var{sequence} into an alist 756 This function separates the elements of @var{sequence} into an alist
728whose keys are the result of applying @var{function} to each element 757whose keys are the result of applying @var{function} to each element
@@ -761,7 +790,6 @@ of type @var{type}. @var{type} can be one of the following symbols:
761@end example 790@end example
762@end defun 791@end defun
763 792
764
765@defmac seq-doseq (var sequence [result]) body@dots{} 793@defmac seq-doseq (var sequence [result]) body@dots{}
766@cindex sequence iteration 794@cindex sequence iteration
767 This macro is like @code{dolist}, except that @var{sequence} can be a list, 795 This macro is like @code{dolist}, except that @var{sequence} can be a list,