emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] sequence manipulation functions


From: Stefan Monnier
Subject: Re: [PATCH] sequence manipulation functions
Date: Thu, 20 Nov 2014 18:16:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> +(defun seq-filter (pred seq)
> +  "Return a list of all the elements for which (PRED element) is non-nil in 
> SEQ."
> +  (delq 'seq--exclude (seq-map (lambda (elt)
> +                                (if (funcall pred elt)
> +                                    elt
> +                                  'seq--exclude))
> +                              seq)))

This won't do the right thing if the list includes the symbol
`seq--exclude' (which could happen if this function is used by, say,
completion code).  Better do a (defvar seq--exclude (make-symbol "exclude"))
and then use the value of `seq--exclude' rather than the constant
`seq--exclude'.

> +  "Reduce the two-arguments function FUNCTION across SEQ, starting with 
> INITIAL-VALUE.

This first line is too long.  I guess we need to drop the "two-arguments" part.

> I have renamed the library "seq" instead of "sequences".

Good.

> seq-doseq macro, similar to dolist.

Actually seq-doseq is "unusable" on lists: it's O(N^2) instead
of O(N).

Otherwise, it looks fine, thank you,


        Stefan



reply via email to

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