aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorDamien Cassou2017-04-17 11:01:39 +0200
committerNicolas Petton2017-05-04 11:32:58 +0200
commit88f96e69cfcd265f2ef0db3e134ac9e29e64ec3e (patch)
treecdf11ece3a34f982ba3bf28bd8f90d659fdc41b1 /doc/lispref
parent250d24fa7333046fb187cf4f544dc4358f16e2df (diff)
downloademacs-88f96e69cfcd265f2ef0db3e134ac9e29e64ec3e.tar.gz
emacs-88f96e69cfcd265f2ef0db3e134ac9e29e64ec3e.zip
Add seq-set-equal-p to test for set equality
* lisp/emacs-lisp/seq.el (seq-set-equal-p): Add function to compare two lists as if they were sets. * test/lisp/emacs-lisp/seq-tests.el (test-seq-set-equal-p): Add test for seq-set-equal-p.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/sequences.texi27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 93e8fa8a5fa..c7cf9f5e1af 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -792,6 +792,33 @@ it is a function of two arguments to use instead of the default @code{equal}.
792 792
793@end defun 793@end defun
794 794
795@defun seq-set-equal-p sequence1 sequence2 &optional testfn
796This function checks whether @var{sequence1} and @var{sequence2}
797contain the same elements, regardless of the order. If the optional
798argument @var{testfn} is non-@code{nil}, it is a function of two
799arguments to use instead of the default @code{equal}.
800
801@example
802@group
803(seq-set-equal-p '(a b c) '(c b a))
804@result{} t
805@end group
806@group
807(seq-set-equal-p '(a b c) '(c b))
808@result{} nil
809@end group
810@group
811(seq-set-equal-p '("a" "b" "c") '("c" "b" "a"))
812@result{} t
813@end group
814@group
815(seq-set-equal-p '("a" "b" "c") '("c" "b" "a") #'eq)
816@result{} nil
817@end group
818@end example
819
820@end defun
821
795@defun seq-position sequence elt &optional function 822@defun seq-position sequence elt &optional function
796 This function returns the index of the first element in 823 This function returns the index of the first element in
797@var{sequence} that is equal to @var{elt}. If the optional argument 824@var{sequence} that is equal to @var{elt}. If the optional argument