From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Philippe Vaucher Newsgroups: gmane.emacs.devel Subject: Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs] Date: Sat, 9 May 2020 17:30:45 +0200 Message-ID: References: <0c88192c-3c33-46ed-95cb-b4c6928016e3@default> <87wo5mc04t.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="99223"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Joost Kremers , Richard Stallman , Emacs developers To: "Alfred M. Szmidt" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 09 17:31:50 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jXRSA-000Phh-18 for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 17:31:50 +0200 Original-Received: from localhost ([::1]:44932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXRS8-00032R-IF for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 11:31:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXRRe-0002XI-3h for emacs-devel@gnu.org; Sat, 09 May 2020 11:31:18 -0400 Original-Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:42815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXRRc-00068L-D9; Sat, 09 May 2020 11:31:17 -0400 Original-Received: by mail-lf1-x12a.google.com with SMTP id r17so745277lff.9; Sat, 09 May 2020 08:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SLZH99waMm6VAHAGIEKCG/oTpS8vc+RKyfEYqYpdcmE=; b=f6r52ScQC9aIOXDuoiXvNC3Ii2fpOYZXH6X8cDh04wMhHnmG41trjIi83VMiEfcm1X fQO23b8uHx5PlL8iVhydOZSmftxVt/4eIbYJ4ZcSnWO9QOcO7sa3PEBzDCEtPVIDxR1S JaO+FY9RahH8q7gdWJ4V6sn4kr6bSy8LIbeUIt0suwYgNdsaGGQuBnD1chiISXT7M6Qi YAi7+tU99NvoWqmA7LR9Dll40+1aVS4smHPg+e3hhbbp1h+7+V84YlFlHdrEIGlbVFxq cj0rxgmdOWBXkFri2e497vzcjuIe4L7oXtAA2aWhTBKyPPwkXLUa+rftbhiUbvNkawh2 t5Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SLZH99waMm6VAHAGIEKCG/oTpS8vc+RKyfEYqYpdcmE=; b=fPvqFxaB/y0VSzNDRNOoAhVbQghQ6t5G9jYXp1PbZGFfumIsxNye5n/d0vQf3BPRGm yY+NqI5MIER2OsyQUrcqC8nafNUoPcrHWwr4PNPVxK7MnQ5NPD+KwIRTjCjRnhDKZqwP 7ac6G5BCgvTuvimRsG3QDLn/l7ZetBY6gbjwKhq85EtHjPcoKzjLB1FB+V4pj7uOFsQ1 DBEelkBgynEXuSBt2iPWL64O5UhEwj8C4tX8Gki4T6WM/Xzndj8FLC9sQJQzgBvrrNyi PlfkXEnmQeJ3rotNMstwMNgjK92mervyioj1kiVuLsLJplTyHJuGjqMvXM9iSxSxZ18v atkw== X-Gm-Message-State: AOAM5320VsskYgujcSUb/u5hcdUkLq8w2WeeOFtwgq7uIB8aIm3AgEO9 EpCF5KqiYGWfNXcV5OJIuZnARKSyRSvwrzMCpca3ngNdxbY= X-Google-Smtp-Source: ABdhPJxdXaasKyvpFzdWFOPL7++0mbpDG5+2j5lC9NvkFikU8DLxzCpNFO5us035YYKDzuvR5XoAidTW/+96I1B2JYw= X-Received: by 2002:ac2:4248:: with SMTP id m8mr5370628lfl.211.1589038272683; Sat, 09 May 2020 08:31:12 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=philippe.vaucher@gmail.com; helo=mail-lf1-x12a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:249470 Archived-At: > Can you give some examples of using dash.el? Let's start with a disclaimer: it's hard to come with examples on the spot. Also because I usually code with dash or seq it's hard for me to know the real "plain emacs lisp" equivalent. (let ((lst '(1 2 3 4))) (pp (--map-when (= it 2) 17 lst)) (pp (mapcar (lambda (it) (if (= it 2) 17 it)) lst))) The point here is that the first one almost reads like english. The intention is very clear (to me). The "pure lisp" one I have to put more attention to it. I guess you'll disagree :-) (let ((lst '("1" 2 "3" 4)) (delme (make-symbol "delme"))) (pp (--remove (and (numberp it) (= it 2)) lst)) (pp (delete delme (mapcar (lambda (it) (if (and (numberp it) (= it 2)) delme it)) lst)))) Yes, I now I can use cl-remove-if or seq-remove, but I think it further illustrates the point: I see both seq- and cl- as attempts at fixing the Emacs api that was lacking. If I'm not mistaken seq.el was even inspired by dash. I was going to make an example with `-flatten` but I think this page is better showing my point: https://stackoverflow.com/questions/969067/name-of-this-function-in-built-in-emacs-lisp-library In many languages, "flatten" is a basic concept. You'd expect something as basic to be in the language... for me dash adresses these "basics" you can't find easily in the manual. Same for other topics (e.g set union/intersection/different), basically any topic related to lists I can look on https://github.com/magnars/dash.el and quickly be productive. Now that I said all this, FWIW I'd agree that because there is seq- and map- we don't really need dash- anymore in Emacs core for a lot of use cases. Maybe the anaphoric/threading functions would be nice but I doubt they'd interest you. Examples of threading: (->> '(1 2 3) (-map 'square) (-remove 'even?)) ;; => '(1 9) (--> "def" (concat "abc" it "ghi") (upcase it)) ;; => "ABCDEFGHI"