[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using gv in map and seq?

From: Stefan Monnier
Subject: Re: Using gv in map and seq?
Date: Wed, 17 Jun 2015 13:39:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> Just out of curiosity, where is this restriction set?

The code I sent was broken (in the list case where we need to set the
MAP, the code does (setq map ..) where `map' is an internal variable,
IOW it sets the wrong thing) so the restriction didn't actually appear.

It should look a bit more like:

  (put 'map--raw-place 'gv-expander #'funcall)
      (lambda (do)
        (gv-letplace (mgetter msetter) map
          (macroexp-let2* nil
              ;; Eval them once and for all in the right order.
              ((key key) (default default))
            `(map--dispatch ,mgetter
               :list ,(gv-get `(alist-get ,key (map--raw-place ,mgetter 
               :hash-table ,(funcall do `(gethash ,key ,mgetter ,default)
                                     (lambda (v) `(puthash ,key ,v ,mgetter)))
               :array ,(funcall do `(aref ,mgetter ,key)
                                (lambda (v) `(aset ,mgetter ,key ,v)))))))))

And this "raw-place" should probably be added to gv.el.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]