From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] extend map-into Date: Sun, 06 Oct 2019 10:02:54 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="174491"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Nicolas Petton , emacs-devel@gnu.org To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 06 16:04:20 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iH791-000jGe-VE for ged-emacs-devel@m.gmane.org; Sun, 06 Oct 2019 16:04:20 +0200 Original-Received: from localhost ([::1]:34714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iH790-0004lw-P0 for ged-emacs-devel@m.gmane.org; Sun, 06 Oct 2019 10:04:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42436) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iH77k-0004kv-LG for emacs-devel@gnu.org; Sun, 06 Oct 2019 10:03:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iH77j-0006PH-7M for emacs-devel@gnu.org; Sun, 06 Oct 2019 10:03:00 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25317) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iH77i-0006LO-NJ for emacs-devel@gnu.org; Sun, 06 Oct 2019 10:02:59 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 14E3E448B1D; Sun, 6 Oct 2019 10:02:57 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F278A448B1B; Sun, 6 Oct 2019 10:02:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1570370576; bh=2yilNrNvY1yDtNFczhG5wEWqGoy5uMVX8M1u2c9RySQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=kYuh8qxvoei2KDSC/M00svmT8iszZHYgNTUcwAVuKonq4eg6fBw3Rj2ZDtN59nPuA 8sgUten50LTljQ0IErkIX3Ny9U59o9ephzYDi9RV4YWyy5Wn3O+ytCrCZJoOtXKFAH hVcIb4J1e9LENnwu4hcDmrXGzaR/n2YwNQUrkhaMxsLMcas5JDV9BLJCBkaiNBziRR OPY7VMlcse7/41TqN/kZHHZ+M6zBR2KtruWUBSkOzteHHrCeZmmbfPt68QpCgJ7MPl oqr95XHZv4Tbre1Je3H0yRIH46FTNSR/qGnzQqQknQr+/WxWlFAkG1JGDSelid30gb QkjfRNd1ZAwsg== Original-Received: from pastel (76-10-181-40.dsl.teksavvy.com [76.10.181.40]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B732B1202A3; Sun, 6 Oct 2019 10:02:55 -0400 (EDT) In-Reply-To: (Andrea Corallo's message of "Sat, 05 Oct 2019 08:28:36 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240643 Archived-At: [ I added Nicolas explicitly in the list, in case he's too busy to read all messages. ] > would a solution like the one in attached patch do the job? Yes and no: it does the job, but only for `map-into`. So that doesn't immediately cover the needs of `map-merge` and other callers of `map-into` (e.g. the `map-values-apply` I suggested which would return a new map). I guess we could use a `type` that's not a symbol but a list (whose head is a symbol and the rest are the args), but it could be a bit inconvenient (and would impact efficiency as well because it makes the cl-generic dispatch more complex). On a related note, maybe it would be good to have map.el primitives that let you create a new map of the same type as another (preserving :test). > + (let* ((h-args (if keyword-args > + keyword-args > + (list :size (map-length map) :test 'equal))) Aka (or keyword-args (list :size (map-length map) :test 'equal)) Stefan