all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philippe Schnoebelen <schnoebelen.ph@gmail.com>
To: emacs-devel@gnu.org
Subject: cl-extra.el : any support for bool-vector type?
Date: Sun, 28 Jul 2019 08:59:12 +0200	[thread overview]
Message-ID: <c8f9f87a-dffa-fa46-afc0-d1f24e4f73c9@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

Was surprised to see that

    (cl-map 'vector #'not '(nil nil 2 3 nil 5 nil 7 nil nil nil 11))

is accepted by emacs while

    (cl-map 'bool-vector #'not '(nil nil 2 3 nil 5 nil 7 nil nil nil 11))

fails with (error "Unknown type bool-vector").

Turns out that cl-extra.el does not support bool-vectors. Is there any
reason for this? Not knowing of any, I've just added one line to
cl-coerce and now I can coerce to bool-vectors. See attachment. Let me
know if I'm being reckless ...  -phs


[-- Attachment #2: patch-against-commit-77ee23d1ed --]
[-- Type: text/plain, Size: 572 bytes --]

diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index ca33c56a95..117c991ffe 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -47,6 +47,7 @@ cl-coerce
 TYPE is a Common Lisp type specifier.
 \n(fn OBJECT TYPE)"
   (cond ((eq type 'list) (if (listp x) x (append x nil)))
+	((eq type 'bool-vector) (if (bool-vector-p x) x (apply #'bool-vector (cl-coerce x 'list))))
 	((eq type 'vector) (if (vectorp x) x (vconcat x)))
 	((eq type 'string) (if (stringp x) x (concat x)))
 	((eq type 'array) (if (arrayp x) x (vconcat x)))

             reply	other threads:[~2019-07-28  6:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-28  6:59 Philippe Schnoebelen [this message]
2019-07-28  8:31 ` cl-extra.el : any support for bool-vector type? Zhu Zihao
2019-08-10  8:16 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8f9f87a-dffa-fa46-afc0-d1f24e4f73c9@gmail.com \
    --to=schnoebelen.ph@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.