* dev/dash-defs.el (dash--find-example-regexp): New variable.
(defexamples): Add it to each function's find-function-type-alist
property in Emacs 31+, to locate the generated ert-deftest as per
the example in Info node "(elisp) Finding Definitions".
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.
* 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.
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.
* dash.el (-partial): Define as alias of apply-partially.
(-applify): Mark as pure and side-effect-free. Simplify for speed.
* dev/examples.el (-partial, -applify): Extend tests.
* README.md:
* dash.texi: Regenerate docs.
* dash.el (-flatten-n): Don't maintain a list of intermediate
results. Eta-reduce.
* dev/examples.el (-flatten-n): Check for destructive side effects.
Re: #373.
* dash.el (--iterate): Evaluate FORM N-1, not N, times, fixing a
regression in Dash 2.18.0. Don't evaluate INIT if N is zero, fixing
a bug since the introduction of the macro.
* dev/examples.el (-flatten-n): Add regression test.
(-iterate): Test for superfluous evaluations.
Fixes#373.
This prepares for the release of dash 2.18.0 and the final obsolete
version 1.3.0 of dash-functional.
* NEWS.md (2.18): Announce obsoletion of dash-functional.el.
* dash-functional.el: Mention obsoletion in package Commentary, and
emit a warning when byte-compiled or loaded.
(-rpartial, -juxt, -compose, -applify, -on, -flip, -const, -cut)
(-not, -orfn, -andfn, -iteratefn, -counter, -fixfn-max-iterations)
(-fixfn, -prodfn): Move from here...
* dash.el: ...to here.
(-partial): Move definition under "Combinators".
* Makefile (ELS, dash-functional.elc):
* dev/dash-defs.el (dash--make-md, dash--make-texi):
* dev/examples.el:
(Function combinators):
* dash-template.texi:
(Installation, Using in a package):
* readme-template.md (Installation, Using in a package): Remove all
uses and mentions of dash-functional.
* README.md:
* dash.texi: Regenerate docs.
Closes#356.
* dev/examples-to-info.el (dash--print-lisp-as-texi)
(example-to-string): Unquote printed expected result, as that is
both more correct and consistent with standard Emacs documentation.
* dash.texi: Regenerate.
* dev/examples-to-info.el (dash--print-lisp-as-texi):
* dev/examples-to-docs.el (dash--print-lisp-as-md): Strip leading
zeros from octal escapes in Emacs 26, for consistency with Emacs
27+.
(example-to-string): Remove redundant print-quoted binding.
* dev/examples-to-docs.el (dash--print-lisp-as-md)
(example-to-string): Unquote printed expected result, as that is
both more correct and consistent with standard Emacs documentation.
* README.md: Regenerate.
* dev/examples.el (-take, -drop, -drop-last, -take-while)
(-running-sum, -running-product, -common-prefix, -common-suffix)
(-list, -each-indexed, -dotimes): Prefer '() over () in printed
examples, as we can control how the former is printed, whereas the
latter is always printed as nil.
* README.md:
* dash.texi: Regenerate docs.
* dev/examples-to-docs.el (def-example-group): Use text properties
to mark group headings.
(function-to-md, function-summary): Simplify accordingly. Remove
gratuitous newlines.
* README.md: Regenerate.
* dev/examples-to-docs.el (create-docs-file): Move 'nil -> '()
replacement from here...
(dash--print-lisp-as-md): ...to this new function.
(example-to-string): Use it to print Lisp in a buffer rather than
manipulating strings.
(defexamples): Move example-to-string call from here...
(function-to-md): ...to here, where it's needed. Replace s-replace
with more correct code.
(s-replace): Remove; no longer used.
* README.md: Regenerate.
* dev/examples-to-docs.el (dash--replace-all): New function.
(create-docs-file): Don't modify functions for more idempotency.
Simplify with dash--replace-all and relative file names.
(simplify-quotes, goto-and-remove, goto-and-replace-all): Remove; no
longer used.