[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Should `position' be implemented in Emacs core and preloaded?
From: |
Tino Calancha |
Subject: |
Should `position' be implemented in Emacs core and preloaded? |
Date: |
Wed, 5 Oct 2016 23:46:54 +0900 (JST) |
User-agent: |
Alpine 2.20 (DEB 67 2015-01-07) |
Hello Emacs,
sometimes i wonder why functions as useful as `position'
are an alias for `cl-position' instead of part of the core. I mean,
they could be implemented out of cl-lib and be preloaded.
Maybe for other more specialized functions is reasonable to load
`cl-lib', but IMO not to just use a fundamental function
as `position' is.
The functions i have in mind are: `position', `position-if',
`position-if-not' and `subsetp'.
*) `position': very fundamental operation on a sequence. It
deserves to be preloaded.
*) `position-if': i like this function very much, it's powerful.
*) `position-if-not': similar as previous one.
*) `subsetp': Another fundamental operation; it allow to check if
several elements belong to one sequence in a compact way.
For instance, compare:
(let ((options '(?a ?b ?v ?c)))
(when (and (member ?a options)
(member ?b options)
(member ?c options))
(message "All are included")))
=> "All are included"
;; with:
(let ((options '(?a ?b ?v ?c)))
(when (subsetp '(?a ?b ?c) options)
(message "All are included")))
=> "All are included"
I) We might implement them in, for instance, subr.el.
This could break backward compatibility in code using
the alias in cl.el, though; not in the current Emacs
source code AFAICT.
II) Alternatively, they could be implemented in a lighter
lib; i guess the natural candidate is seq.el.
Note that this lib already has `seq-position'.
III) We might keep everything as it is.
IV) Other options that i couldn't imagine.
I would be glad to read your opinions about this idea.
Thank you very much.
Tino
- Should `position' be implemented in Emacs core and preloaded?,
Tino Calancha <=