A modern list api for Emacs. No 'cl required.
M-x package-install dash
Or you can just dump
dash.el in your load
If you want the function combinators, then also:
M-x package-install dash-functional
Using in a package
Add this to the big comment block at the top:
;; Package-Requires: ((dash "2.10.0"))
To get function combinators:
;; Package-Requires: ((dash "2.10.0") (dash-functional "1.2.0") (emacs "24"))
Syntax highlighting of dash functions
Font lock of dash functions in emacs lisp buffers is now optional. Include this in your emacs settings to get syntax highlighting:
(eval-after-load "dash" '(dash-enable-font-lock))
[[ function-list ]]
There are also anaphoric versions of functions where that makes sense, prefixed with two dashes instead of one.
-map takes a function to map over the list, you can also use
the anaphoric form with double dashes - which will then be executed
it exposed as the list item. Here's an example:
(-map (lambda (n) (* n n)) '(1 2 3 4)) ;; normal version (--map (* it it) '(1 2 3 4)) ;; anaphoric version
of course the original can also be written like
(defun square (n) (* n n)) (-map 'square '(1 2 3 4))
which demonstrates the usefulness of both versions.
[[ function-docs ]]
Yes, please do. Pure functions in the list manipulation realm only,
please. There's a suite of tests in
dev/examples.el, so remember to add
tests for your function, or I might break it later.
You'll find the repo at:
Run the tests with
Create the docs with
I highly recommend that you install these as a pre-commit hook, so that the tests are always running and the docs are always in sync:
cp pre-commit.sh .git/hooks/pre-commit
Oh, and don't edit
README.md directly, it is auto-generated.
From 2.9 to 2.10
From 2.8 to 2.9
From 2.7 to 2.8
From 2.6 to 2.7
-zipnow supports more than two lists (Steve Lamb)
-table-flat(finite cartesian product)
-slicenow supports "step" argument
- Add functional combinators
From 2.5 to 2.6
From 2.4 to 2.5
- A few bugfixes
From 2.3 to 2.4
From 2.2 to 2.3
- Add tree operations (Matus Goljer)
- Make font-lock optional
From 2.1 to 2.2
From 2.0 to 2.1
- Add indexing operations (Matus Goljer)
From 1.8 to 2.0
- Split out
-on. (Matus Goljer)
From 1.7 to 1.8
From 1.6 to 1.7
From 1.5 to 1.6
From 1.4 to 1.5
From 1.3 to 1.4
From 1.2 to 1.3
From 1.1 to 1.2
- Some bugfixes
- Matus Goljer contributed lots of features and functions.
Takafumi Arakaki contributed
tali713 is the author of
Víctor M. Valenzuela contributed
Nic Ferrier contributed
Wilfred Hughes contributed
Emanuel Evans contributed
Johan Andersson contributed
Christina Whyte contributed
Steve Lamb contributed
-zip-filland an n-ary version of
Fredrik Bergroth made the
-letdestructuring and improved script for generating documentation.
- Mark Oteiza contributed the script to create an info manual.
Copyright (C) 2012-2014 Magnar Sveen
Authors: Magnar Sveen firstname.lastname@example.org Keywords: lists
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.