Functions that guarantee a fresh return value should not be pure,
since their return value is likely to be mutated destructively:
https://bugs.gnu.org/64127
* NEWS.md (2.20.0): List affected functions.
* dash.el (-non-nil, -cons*, -snoc, -slice, -take, -take-last)
(-drop-last, -split-at, -interpose, -interleave, -repeat, -iota)
(-clone): No longer mark as pure.
* dev/examples.el (-powerset): Avoid mutating constant.
Fixes#405.
* NEWS.md (2.20.0): Announce deprecation of dyadic -zip calling
convention.
* readme-template.md (Change log): Retract promise to
break -zip (issue #400).
* dash.el (--reject-first): Pacify Emacs 24 macro #'-quoting
warning.
(-remove-at, -zip-fill): Optimize. Extend docstring.
(-remove-at-indices): Handle empty list input. Optimize. Clarify
docstring.
(--zip-with, -zip-lists): Simplify. Extend docstring.
(-zip-with): Fix docstring.
(-zip-lists-fill, -unzip-lists, dash--length=)
(dash--zip-lists-or-pair): New functions.
(-zip): Replace anonymous compiler-macro with
dash--zip-lists-or-pair for the benefit of Emacs 24.3. Use
dash--length= in place of length. Clarify docstring.
(-zip-pair): Make variadic again for backward compatibility with
when it used to be an alias of -zip, and declare a dyadic
advertised-calling-convention instead. Delegate to -zip-lists as
needed. Clarify docstring.
(-unzip): Clarify docstring (issue #400).
(dash--match-kv-normalize-match-form, -let): Simplify.
(-prodfn): Optimize.
Fixes#400.
* dash.el: Update copyright notice for 2022. Quote function symbols
as such.
(-zip-pair): No longer alias -zip.
(-zip): Rewrite in terms of -zip-pair or -zip-lists, including as a
compiler macro. Emit warning when called with two arguments.
(-unzip): Add FIXME commentary.
(-let): Prefer -zip-pair over -zip with two arguments.
(dash-fontify-mode-lighter, dash-fontify-mode)
(global-dash-fontify-mode, dash-enable-fontlock): Remove strictly
not needed :group keywords.
Re: issue #400.
Otherwise upstream changes to the docstring of append will cause
needless churn, as well as annoyances for contributors on different
Emacs versions.
* dash.el (-concat): Give it append's current upstream docstring.
* README.md:
* dash.texi: Regenerate docs.
* dash.el (-repeat): Use >= in place of natnump, for speed.
* dev/examples.el (-repeat, -cycle): Move from "Other list
operations" to "Unfolding".
* README.md:
* dash.texi: Regenerate docs.
* NEWS.md (2.19.2): Rename...
(2.20.0): ...to this. Announce changes.
* README.md:
* dash.texi: Regenerate docs.
* dash.el (-compare-fn): Clarify docstring.
(dash--member-fn, dash--hash-test-fn, dash--size+): New convenience
functions.
(dash--short-list-length): New variable.
(-distinct, -union, -intersection, -difference): Check for empty
list early. Prefer dash--member-fn over -contains? for speed.
Exclude duplicates from return value. Use a hash table for long
lists, but avoid its overhead for short lists.
(-contains?): Delegate to member if -compare-fn is either equal or
nil, not just nil. Reimplement in terms of dash--member-fn.
(-same-items?): Support multisets of different length. Use hash
tables for long lists.
* dev/examples.el (-same-items?): Move from "Predicates" to "Set
operations". Extend tests.
(-contains?, -union, -difference, -intersection, -distinct): Extend
tests.
(dash--member-fn, dash--hash-test-fn, dash--size+): New tests.
* dash.el (-first): Contrast -first with -first-item, not car, in
docstring.
(-elem-index, --find-index, --find-last-index): Avoid constructing a
list of results just to throw most of them away. Suggested by
Philippe Vaucher (#394).
(--find-indices): Use --keep for speed.
(-elem-indices, -find-indices): Use --find-indices for speed.
(-find-index, -find-last-index): Use anaphoric counterpart for
speed.
* dev/examples.el (-elem-index, -elem-indices, -find-index)
(-find-last-index, -find-indices): Extend tests.
* README.md:
* dash.texi: Regenerate docs.
Fixes#394.
* Makefile (els): Add dev/examples.el so that it's byte-compiled.
(check): Prefer dev/examples.elc over dev/examples.el.
($(docs)): Remove redundant dependency.
(dev/dash-defs.elc, dev/examples.elc): Manually list dependencies.
* dash.el: Add pure and side-effect-free to defun-declarations-alist
as no-ops when needed, to avoid warnings in Emacsen that lack them.
(--reductions): Pacify uninitialized lexvar warnings in recent
Emacsen (issue #377).
(--splice, -splice): Reimplement the function in terms of the macro
for efficiency and to avoid unused lexvar warnings. Expand
docstrings.
(--map-first, --map-last, --splice-list, --update-at, --split-when)
(--annotate, --find-indices, --find-index, --find-last-index)
(--sort, --max-by, --min-by, --fix, --unfold, --tree-mapreduce-from)
(--tree-mapreduce, --tree-map, --tree-reduce-from, --tree-reduce)
(--tree-map-nodes, --tree-seq): Pacify unused lexvar warnings.
(-value-to-list, -tree-mapreduce-from, -tree-mapreduce, -tree-map)
(-tree-reduce-from, -tree-reduce, -tree-map-nodes, -tree-seq):
Simplify slightly.
* dev/dash-defs.el: Load ert for the benefit of generated tests.
(dash--example-to-test): Remove eval needed in old Emacsen; call it
on a case-by-case basis instead.
(defexamples): Ensure ert-deftest bodies are nonempty.
(dash--describe, dash--lisp-to-md): Move defvar declarations to
top-level or else old Emacsen will complain.
* dev/examples.el: Work around https://bugs.gnu.org/14883 by
enabling byte-compile-delete-errors as needed.
(dash-expand:&hash-or-plist): Wrap in eval-when-compile.
(-splice): Extend tests.
(-map-when, -flatten-n, -list, -some-->, -when-let, -let, -let*)
(-lambda, -setq): Pacify or work around byte-compiler warnings or
errors.
* README.md:
* dash.texi: Regenerate docs.
* dash.el (-flatten, dash--match-cons-1, -distinct, -unfold):
Remove `...' quoting around nil and t in docstrings and commentary,
as per (info "(elisp) Documentation Tips").
(-snoc): Make wording of docstring sound a bit more natural.
(-any?, -none?): Upcase metavariables in docstrings.
* dev/dash-defs.el (dash--booleans-to-md): New function.
(dash--docstring-to-md): Use it to mark up nil/t with backquotes.
(dash--docstring-to-texi): Mark up nil/t as @code.
* README.md:
* dash.texi: Regenerate docs.
Emacs 29 no longer indents functions/macros with a name starting
with 'def' as a 'def' construct with a body starting on the second
line.
* dev/dash-defs.el (def-example-group, defexamples): Explicitly
indent as defuns.
* dash.el (-map-when, -map-first, -map-last, -only-some?)
(-update-at, -split-with, -separate)
(dash--partition-all-in-steps-reversed, -partition-all-in-steps)
(-partition-in-steps, --zip-with, -union, -intersection, -prodfn):
Refill and reword docstrings to fit in 80 columns.
(-concat): Eta-reduce, defining as an alias of append.
* dev/examples.el (-partition-all-in-steps): Add a jagged test case.
* README.md:
* dash.texi: Regenerate docs.
Fixes#389.
* .dir-locals-file.el (bug-reference-bug-regexp)
(bug-reference-url-format): Remove in preference of Emacs 28's more
general DWIM setup. Users on older Emacs versions can still add the
relevant incantations to their personal .dir-locals-2.el file.
* dash.el (-is-suffix?): Don't assume that first element of suffix
appears only once (PR #384). This fixes a regression in v2.18.0.
Copyright-paperwork-exempt: yes
This is a rewrite and extension of PR #72 to address issue #306.
For discussion, especially wrt performance, see PRs #72 and #308.
* dash.el (-on, -flip, -not, -orfn, -andfn): Return a variadic
function. Declare as pure and side-effect-free.
(-rotate-args): New combinator suggested by @vapniks in PR #72.
(-const): Declare as pure and side-effect-free.
* NEWS.md (2.19.0): Announce -rotate-args and variadic combinators.
* dev/examples.el (-partition-after-pred): Fix oddp bug waiting to
happen with negative dividends.
(-cons*): Check that &rest args are safe to mutate.
(-on, -flip, -const, -not, -orfn, -andfn): Extend tests.
(-rotate-args): New test.
* README.md:
* dash.texi: Regenerate docs.
* dash.el (--every, -every): New definitions; to --every-p and
-every-p what --some and -some are to --some-p and -some-p,
respectively.
(--any?): Open-code ---truthy? for clarity.
(--all?): Rewrite in terms of --every. Extend docstring.
(-all?): Extend docstring.
* dev/examples.el (-any?, -all?, -some): Extend tests.
(-every): New tests.
* NEWS.md (2.19.0): Announce -every and --every.
* README.md:
* dash.texi: Regenerate docs.
This reverts commit 92562909a7
"* dash.el (-->): Indent with 1 distinguished arg."
of 2021-01-10.
This reverts commit 911ef09a30
"* dash.el (->, ->>): Indent with 1 distinguished arg."
of 2021-03-08.
The Clojure-inspired threading macros -> and ->> are quite popular
and were indented until recently with no distinguished arguments as
per Clojure conventions. In Elisp practice this is not a problem
since the macros have short names. For the converse argument
against threading macros such as -some-> that have longer names, see
the discussion in #319 and #321.
This commit reverts relatively recent breaking and controversial
indentation changes that tried to make ->, ->>, and --> more
consistent with the rest of Dash, including -some->, -doto,
etc. which are all indented with a distinguished argument despite
being inspired by Clojure. For the relevant discussion, see #375.
* dash.el (->, ->>, -->): Indent without a distinguished argument.
(-as->, -some->, -some->>, -fixfn): Reindent.
* NEWS.md (2.19.0): Announce indentation change to -->.
The first argument becomes a function name. It can't be instrumented
because that would result in an invalid form such as
((edebug-after 0 1 FUNCTION) ...)