From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#28753: 25.3; Functions to get alist from hash table and vice versa Date: Thu, 12 Oct 2017 11:56:01 -0400 Message-ID: References: <54ecd1bb-0c84-4b0a-b19e-3a89cbe832bc@default> <87r2uce9u8.fsf@web.de> <3da0f75d-6000-410d-9e0b-ea293677b5ed@default> <87wp4038m0.fsf@web.de> <87r2u8sdh5.fsf@petton.fr> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1507823892 31544 195.159.176.226 (12 Oct 2017 15:58:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 12 Oct 2017 15:58:12 +0000 (UTC) Cc: Michael Heerdegen , 28753@debbugs.gnu.org To: Nicolas Petton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 12 17:58:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1e2fs6-0007S2-Dt for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Oct 2017 17:58:06 +0200 Original-Received: from localhost ([::1]:46206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2fsD-00085p-PO for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Oct 2017 11:58:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2fr8-0007Tt-IO for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2017 11:57:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2fr4-0000Cw-2U for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2017 11:57:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e2fr3-0000Cc-UH for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2017 11:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e2fr3-00038s-Kn for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2017 11:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Oct 2017 15:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28753 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28753-submit@debbugs.gnu.org id=B28753.150782377012004 (code B ref 28753); Thu, 12 Oct 2017 15:57:01 +0000 Original-Received: (at 28753) by debbugs.gnu.org; 12 Oct 2017 15:56:10 +0000 Original-Received: from localhost ([127.0.0.1]:36273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2fqD-00037Y-Rq for submit@debbugs.gnu.org; Thu, 12 Oct 2017 11:56:10 -0400 Original-Received: from mail-wm0-f43.google.com ([74.125.82.43]:55255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2fqC-00037L-14 for 28753@debbugs.gnu.org; Thu, 12 Oct 2017 11:56:08 -0400 Original-Received: by mail-wm0-f43.google.com with SMTP id i124so14619867wmf.3 for <28753@debbugs.gnu.org>; Thu, 12 Oct 2017 08:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ydHiv/CPAqcGp55WdHZreeAEq8KaR4qCsBBvRla92yk=; b=EEOHbBxXcOT/94l+TU0O201spykvZco9ZGxTz9+0yyIaDR2ERlYg1MnROKgugzni+2 dvES+c/PAoeUDphy7yxnWBd9dLdmRezj7vTqTXGRqZQLIMiw4nfSLGMrgyqUfkwKiT/1 SuFwoKlUExpCZc8bDkhDv3d3UWzSqlafA/IdX+gJOIweOhSk5hAizqoxSFD5Z5adHpv+ SA8axdxL7+SJ8sdpYettxxECw0kDTIImdmzscTXmsp9FbAFJULakvuRLz+fQ8+key++r lomdAuD1fpIg1T3gg3zZ+5lqR5abyy5jjaEwgvp2LiNLzcSQlmqOOjmfAlQ1EkhIHywM LHbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ydHiv/CPAqcGp55WdHZreeAEq8KaR4qCsBBvRla92yk=; b=UI0vIoH3vNF0da1XtqmgjUfcPqjwvAtiD79B8z3VmDBBUaI8OiHHS5V34LL/IiCGlT G30DOfpt28aCKYRagUVfBx5A6gcHSk64Ane5YxpkPkPUG64EcoUmSkH6LpChNUbNS6tP eTsIdez2SOPPX4yxM9S6nVi7lweKGA+LXHFry6MVbKf5DUkUo2ldAZnNGFm/uQ9mxHE9 LLYanlid5tNsV6NJONr5rIO6Pii4PY0Iprqhpd/ee+XW9BTJmPrU6opw/GvEjt6SzdwK 8VTRtXYn0go0kxcHKzpvKzFAZMw164XjsonC8h4NcX9KwLQAw/l8zqUFqxYhMqfFQ9Id wcbw== X-Gm-Message-State: AMCzsaVZQWg0a0TDBchXU+R9Km/x5CJ+kKsLxuopy1N6JrG2lMs+1cWc XUD5TxKe7PdGmi+e27Utar/NFBvgGZNCc8rHS70= X-Google-Smtp-Source: AOwi7QAqoDgcWKqQilcPQKO2/leAtzhbB4FcJDiAZUeevwpNI1+jTUvRX1kd4SPGuvGQRdO3WvhxmrYoDVpKb2jrxsU= X-Received: by 10.223.176.199 with SMTP id j7mr2766981wra.58.1507823762214; Thu, 12 Oct 2017 08:56:02 -0700 (PDT) Original-Received: by 10.223.146.193 with HTTP; Thu, 12 Oct 2017 08:56:01 -0700 (PDT) In-Reply-To: <87r2u8sdh5.fsf@petton.fr> X-Google-Sender-Auth: 8AqEuN34h5oiMHhvdUZDi2IyWKM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138294 Archived-At: On Thu, Oct 12, 2017 at 9:27 AM, Nicolas Petton wrote: > Michael Heerdegen writes: > >>> Actually, going from alist to hash table doesn't look so >>> useful with `map-into'. A caller should be able to specify >>> the hash-table parameters (features), such as :test. >> >> Yeah, that's what I thought, too. > > That's something I can easily add. `map-into' would then look like > the following `(defun map-into (map type &rest keywords))'. > > However, `keywords' would be ignored when converting to an alist. I'm > not sure I like it. What about just receiving the hash-table as a parameter: (defun map-into (map type) "Convert the map MAP into a map of type TYPE. TYPE can be one of the following symbols: `list', `hash-table'; or it can be a hash-table to use. MAP can be a list, hash-table or array." (pcase type (`list (map-pairs map)) (`hash-table (map--into-hash-table map)) ((pred hash-tablep) (map--into-existing-hash-table map type) (_ (error "Not a map type name: %S" type))))) (defun map--into-existing-hash-table (map hash-table) ...)