unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Nicolas Petton <nicolas@petton.fr>
Cc: Tino Calancha <tino.calancha@gmail.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: [ELPA] New package: hap.el
Date: Thu, 2 Mar 2017 18:37:05 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1703021835530.29228@calancha-pc> (raw)
In-Reply-To: <87varskq3j.fsf@petton.fr>



On Thu, 2 Mar 2017, Nicolas Petton wrote:

> Yes, indeed.  The bug is actually in `map-apply':
>
>  (let ((map '((1 . a) (1 . foo) (2 . b))))
>    (map-apply (lambda (key val) key)
>               map)) ;; => (1 1 2)
>
> I guess we don't want to iterate over duplicate keys.
Hi Nico,

i guess following might also confuse someone:

(let* ((ht #s(hash-table test equal data ("foo" 1 "bar" 2)))
        (alist (map-into ht 'list)))
   (list
    (map-elt ht "foo")
    (map-elt alist "foo")
    (cdr (assoc "foo" alist))))
(1 nil 1)

Probably would be safer default to `assoc' in `map-elt'.  That is 
consistent with the default test in `map-contains-key' and with
the hash table test in `map--into-hash-table'.

Best regards,
Tino



  reply	other threads:[~2017-03-02  9:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01  9:00 [ELPA] New package: hap.el Tino Calancha
2017-03-01 13:44 ` Mark Oteiza
2017-03-01 13:46 ` Stefan Monnier
2017-03-02  6:02   ` Tino Calancha
2017-03-02  6:43     ` Stefan Monnier
2017-03-02  6:52       ` Tino Calancha
2017-03-02  9:03       ` Nicolas Petton
2017-03-02  9:37         ` Tino Calancha [this message]
2017-03-02 10:29           ` Nicolas Petton
2017-03-02 12:38           ` Nicolas Petton
2017-03-02 13:07             ` 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

  List information: https://www.gnu.org/software/emacs/

* 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.1703021835530.29228@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nicolas@petton.fr \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).