]> git.eshelyaron.com Git - emacs.git/commit
Add `value<` (bug#69709)
authorMattias EngdegÄrd <mattiase@acm.org>
Sun, 10 Mar 2024 12:18:22 +0000 (13:18 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 29 Mar 2024 12:33:26 +0000 (13:33 +0100)
commit876dee2cdb89cb56219ef336aeb38a22d5cba92e
treedff4aabe5e883c2b3585a743be0daf35c28e80a7
parent1180b32c3155463b32aad65eddd339a04c17b883
Add `value<` (bug#69709)

It's a general-purpose polymorphic ordering function, like `<` but
for any two values of the same type.

* src/data.c (syms_of_data): Add the `type-mismatch` error.
(bits_word_to_host_endian): Move...
* src/lisp.h (bits_word_to_host_endian): ...here, and declare inline.
* src/fns.c (Fstring_lessp): Extract the bulk of this function to...
(string_cmp): ...this 3-way comparison function, for use elsewhere.
(bool_vector_cmp, value_cmp, Fvaluelt): New.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Add `value<`, which is pure and side-effect-free.
* test/src/fns-tests.el (fns-value<-ordered, fns-value<-unordered)
(fns-value<-type-mismatch, fns-value<-symbol-with-pos)
(fns-value<-circle, ert-deftest fns-value<-bool-vector): New tests.
* doc/lispref/sequences.texi (Sequence Functions):
* doc/lispref/numbers.texi (Comparison of Numbers):
* doc/lispref/strings.texi (Text Comparison):
Document the new value< function.
* etc/NEWS: Announce.

(cherry picked from commit 1232ab31c656b8564984a758957466f90ac10501)
doc/lispref/numbers.texi
doc/lispref/sequences.texi
doc/lispref/strings.texi
etc/NEWS
lisp/emacs-lisp/byte-opt.el
src/data.c
src/fns.c
src/lisp.h
test/src/fns-tests.el