all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* cl-extra.el : any support for bool-vector type?
@ 2019-07-28  6:59 Philippe Schnoebelen
  2019-07-28  8:31 ` Zhu Zihao
  2019-08-10  8:16 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Schnoebelen @ 2019-07-28  6:59 UTC (permalink / raw)
  To: emacs-devel

[-- 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)))

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: cl-extra.el : any support for bool-vector type?
  2019-07-28  6:59 cl-extra.el : any support for bool-vector type? Philippe Schnoebelen
@ 2019-07-28  8:31 ` Zhu Zihao
  2019-08-10  8:16 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Zhu Zihao @ 2019-07-28  8:31 UTC (permalink / raw)
  To: Philippe Schnoebelen; +Cc: emacs-devel

AFAIK, `cl` package is a simulation of Common Lisp, and ANSI CL didn't define
bool vector(but there was bit-vector).

If you want to add support for such data structure, why not do it in `seq.el`?





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cl-extra.el : any support for bool-vector type?
  2019-07-28  6:59 cl-extra.el : any support for bool-vector type? Philippe Schnoebelen
  2019-07-28  8:31 ` Zhu Zihao
@ 2019-08-10  8:16 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2019-08-10  8:16 UTC (permalink / raw)
  To: Philippe Schnoebelen; +Cc: emacs-devel

> From: Philippe Schnoebelen <schnoebelen.ph@gmail.com>
> Date: Sun, 28 Jul 2019 08:59:12 +0200
> 
> 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

Thanks, I pushed this to the master branch.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-10  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-28  6:59 cl-extra.el : any support for bool-vector type? Philippe Schnoebelen
2019-07-28  8:31 ` Zhu Zihao
2019-08-10  8:16 ` Eli Zaretskii

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.