unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master d3d60ab: Remove unnecessary dependency on seq library
       [not found] ` <20210103220055.5BBC120999@vcs0.savannah.gnu.org>
@ 2021-01-04  2:24   ` Basil L. Contovounesios
  2021-01-04  3:09     ` Mark Oteiza
  0 siblings, 1 reply; 2+ messages in thread
From: Basil L. Contovounesios @ 2021-01-04  2:24 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: emacs-devel

mvoteiza@udel.edu (Mark Oteiza) writes:

> branch: master
> commit d3d60ab2723fe4b3fa15f4d593319d0d08892cb0
> Author: Mark Oteiza <mvoteiza@udel.edu>
> Commit: Mark Oteiza <mvoteiza@udel.edu>
>
>     Remove unnecessary dependency on seq library
>     
>     * lisp/json.el: Remove require declaration.
>     (json-encode-array): Just use length and /=.
> ---
>  lisp/json.el | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lisp/json.el b/lisp/json.el
> index f5659d8..2498659 100644
> --- a/lisp/json.el
> +++ b/lisp/json.el
> @@ -55,7 +55,6 @@
>  ;;; Code:
>  
>  (require 'map)
> -(require 'seq)
>  (require 'subr-x)
>  
>  ;; Parameters
> @@ -655,7 +654,7 @@ become JSON objects."
>  (defun json-encode-array (array)
>    "Return a JSON representation of ARRAY."
>    (if (and json-encoding-pretty-print
> -           (not (seq-empty-p array)))
> +           (/= 0 (length array)))

The reason for seq-empty-p was that it doesn't traverse the entire
length of lists.  Please keep this optimisation, e.g. via:

  (if (listp array)
      array
    (> (length array) 0))

Thanks,

-- 
Basil



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master d3d60ab: Remove unnecessary dependency on seq library
  2021-01-04  2:24   ` master d3d60ab: Remove unnecessary dependency on seq library Basil L. Contovounesios
@ 2021-01-04  3:09     ` Mark Oteiza
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Oteiza @ 2021-01-04  3:09 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: emacs-devel

On 04/01/21 at 02:24am, Basil L. Contovounesios wrote:
> mvoteiza@udel.edu (Mark Oteiza) writes:
> 
> > branch: master
> > commit d3d60ab2723fe4b3fa15f4d593319d0d08892cb0
> > Author: Mark Oteiza <mvoteiza@udel.edu>
> > Commit: Mark Oteiza <mvoteiza@udel.edu>
> >
> >     Remove unnecessary dependency on seq library
> >     
> 
> The reason for seq-empty-p was that it doesn't traverse the entire
> length of lists.  Please keep this optimisation, e.g. via:
> 
>   (if (listp array)
>       array
>     (> (length array) 0))
> 

Thank you, I pushed the fix.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-04  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210103220053.27764.38848@vcs0.savannah.gnu.org>
     [not found] ` <20210103220055.5BBC120999@vcs0.savannah.gnu.org>
2021-01-04  2:24   ` master d3d60ab: Remove unnecessary dependency on seq library Basil L. Contovounesios
2021-01-04  3:09     ` Mark Oteiza

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).