all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Cc: Tino Calancha <tino.calancha@gmail.com>
Subject: Should `position' be implemented in Emacs core and preloaded?
Date: Wed, 5 Oct 2016 23:46:54 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1610052343000.5173@calancha-pc> (raw)


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



             reply	other threads:[~2016-10-05 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 14:46 Tino Calancha [this message]
2016-10-05 15:13 ` Should `position' be implemented in Emacs core and preloaded? Stefan Monnier
2016-10-05 15:37   ` Tino Calancha
2016-10-05 15:50     ` Stefan Monnier
2016-10-05 16:14       ` Tino Calancha

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=alpine.DEB.2.20.1610052343000.5173@calancha-pc \
    --to=tino.calancha@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.