From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Should `position' be implemented in Emacs core and preloaded? Date: Wed, 5 Oct 2016 23:46:54 +0900 (JST) Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1475678913 12928 195.159.176.226 (5 Oct 2016 14:48:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Oct 2016 14:48:33 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Tino Calancha To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 05 16:48:29 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brnUh-0002qX-OK for ged-emacs-devel@m.gmane.org; Wed, 05 Oct 2016 16:48:27 +0200 Original-Received: from localhost ([::1]:49666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brnUg-0000XZ-9r for ged-emacs-devel@m.gmane.org; Wed, 05 Oct 2016 10:48:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brnTN-0000Eh-6e for emacs-devel@gnu.org; Wed, 05 Oct 2016 10:47:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brnTJ-0007v0-0A for emacs-devel@gnu.org; Wed, 05 Oct 2016 10:47:04 -0400 Original-Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:34323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brnTI-0007uu-NI for emacs-devel@gnu.org; Wed, 05 Oct 2016 10:47:00 -0400 Original-Received: by mail-pa0-x22b.google.com with SMTP id rz1so30809342pab.1 for ; Wed, 05 Oct 2016 07:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:user-agent:mime-version; bh=z+vMluCN0vvE6djYRLni3tkG2y0r4h5oWaFxuAqVgJI=; b=EP6xO3PQtFgxUbFCNfEI2mUiO4TFNcTB2aDGMfFKCqyMsxmzRYpqf1B3XpRsCfB34L IwkSucESEpxPc/iMyqEd69nXlSOEfcFM3biOFZUqlPTzMCJuELUAABG72k4MSZA1Jljh YO8tjkFBlisGV/NEkzoVvZasgtCSYTw+ZOk5OBknUJPtKtQlL9RDmKXM4sj0wHpwkizZ Wgc3/GxmcvkxkiGxv/E5Ui3rPF1Yzst7pV5tghleJk2aEU+TK48vo6Bpy16fNC/NQ65z 63XOqmm+8yVYUYNnN9o7M1ujLLG0V+bJYbIbU4SeCKRvvnagWlGb7Czs1ucP0GLSrpHM 0cCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:message-id:user-agent :mime-version; bh=z+vMluCN0vvE6djYRLni3tkG2y0r4h5oWaFxuAqVgJI=; b=YfcSTtU1p1npnHUOUxSHRAbM9A8Vt85x57EA2wtK72ZUVFFbINuMEMzb9LKTmLrbty Y0GFKe/WcmGq2JZinKjs/1Oat3LkQnuzF0w6A7/xxlJgWGjPc671rLwKVhzybIyxXgip u/dQkJpOyWOADXxsqcoRTJa+tvvJvMRpYC2zJRV9XNNPYWJ9JhIMn5UKJp57ajIcf59/ WMqMR4ozpOoeo8O+OpiwbgbNwe18Nz4o3pulFrAUfPK3zBcefHooJ9GQAG5cknkldeoF d721XYgzk5CA78LzYKm1SzRiZfF3GzmUBhIqMnu86HX+N+Cc9yX7hGri6zjzRrnPtadX +t/A== X-Gm-Message-State: AA6/9RlfeimEjHv8D6/9angT++580fVTLhPVXFxeP/SsNtHFXIh3f4hJUrs8OVgeW+fisw== X-Received: by 10.66.84.132 with SMTP id z4mr13677579pay.108.1475678819670; Wed, 05 Oct 2016 07:46:59 -0700 (PDT) Original-Received: from calancha-pc (57.92.100.220.dy.bbexcite.jp. [220.100.92.57]) by smtp.gmail.com with ESMTPSA id xv9sm14890695pab.36.2016.10.05.07.46.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Oct 2016 07:46:59 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208007 Archived-At: 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