[![CI](https://github.com/magnars/dash.el/actions/workflows/test.yml/badge.svg)](https://github.com/magnars/dash.el/actions/workflows/test.yml)
[![GNU ELPA](https://elpa.gnu.org/packages/dash.svg)](https://elpa.gnu.org/packages/dash.html)
[![GNU-devel ELPA](https://elpa.gnu.org/devel/dash.svg)](https://elpa.gnu.org/devel/dash.html)
[![MELPA Stable](https://stable.melpa.org/packages/dash-badge.svg)](https://stable.melpa.org/#/dash)
[![MELPA](https://melpa.org/packages/dash-badge.svg)](https://melpa.org/#/dash)
# <img align="right" src="rainbow-dash.png"> dash.el
A modern list API for Emacs. No
[`'cl`](https://gnu.org/software/emacs/manual/html_node/cl/) required.
See the end of the file for license conditions.
## Contents
* [Change log](#change-log)
* [Upcoming breaking change!](#upcoming-breaking-change)
* [Installation](#installation)
* [Functions](#functions)
* [Contribute](#contribute)
* [Contributors](#contributors)
* [License](#license)
## Change log
See the [`NEWS.md`](NEWS.md) file.
### Upcoming breaking change!
- For backward compatibility reasons, `-zip` when called with two
lists returns a list of cons cells, rather than a list of proper
lists. This is a clunky API, and may be changed in a future release
to always return a list of proper lists, as `-zip-lists` currently
does.
**N.B.:** Do not rely on the current behavior of `-zip` for two
lists. Instead, use `-zip-pair` for a list of cons cells, and
`-zip-lists` for a list of proper lists.
## Installation
Dash is available on [GNU ELPA](https://elpa.gnu.org/), [GNU-devel
ELPA](https://elpa.gnu.org/devel/), and [MELPA](https://melpa.org/),
and can be installed with the standard command `package-install`:
M-x package-install RET dash RET
See [`(info "(emacs) Package
Installation")`](https://gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html).
Alternatively, you can just dump `dash.el` in your `load-path`
somewhere. See [`(info "(emacs) Lisp
Libraries")`](https://gnu.org/software/emacs/manual/html_node/emacs/Lisp-Libraries.html).
### Using in a package
Add something like this to the library's headers:
;; Package-Requires: ((dash "2.19.1"))
See [`(info "(elisp) Library
Headers")`](https://gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html).
### Fontification of special variables
Font lock of special Dash variables (`it`, `acc`, etc.) in Emacs Lisp
buffers can optionally be enabled with the autoloaded minor mode
`dash-fontify-mode`. In older Emacs versions which do not dynamically
detect macros, the minor mode also fontifies Dash macro calls.
To automatically enable the minor mode in all Emacs Lisp buffers, just
call its autoloaded global counterpart `global-dash-fontify-mode`,
either interactively or from your `user-init-file`:
```el
(global-dash-fontify-mode)
```
### Info symbol lookup
While editing Elisp files, you can use `C-h S` (`info-lookup-symbol`)
to look up Elisp symbols in the relevant Info manuals (see [`(emacs)
Info
Lookup`](https://gnu.org/software/emacs/manual/html_node/emacs/Info-Lookup.html)).
To enable the same for Dash symbols, use the command
`dash-register-info-lookup`. It can be called directly when needed,
or automatically from your `user-init-file`. For example:
```el
(with-eval-after-load 'info-look
(dash-register-info-lookup))
```
## Functions
All functions and constructs in the library use a dash (`-`) prefix.
The library also provides anaphoric macro versions of functions where
that makes sense. The names of these macros are prefixed with two
dashes (`--`) instead of one.
While `-map` applies a function to each element of a list, its
anaphoric counterpart `--map` evaluates a form with the local variable
`it` temporarily bound to the current list element instead. For
example:
```el
(-map (lambda (n) (* n n)) '(1 2 3 4)) ; Normal version.
(--map (* it it) '(1 2 3 4)) ; Anaphoric version.
```
The normal version can of course also be written as follows:
```el
(defun my-square (n)
"Return N multiplied by itself."
(* n n))
(-map #'my-square '(1 2 3 4))
```
This demonstrates the utility of both versions.
### Maps
Functions in this category take a transforming function, which
is then applied sequentially to each or selected elements of the
input list. The results are collected in order and returned as a
new list.
* [`-map`](#-map-fn-list) `(fn list)`
* [`-map-when`](#-map-when-pred-rep-list) `(pred rep list)`
* [`-map-first`](#-map-first-pred-rep-list) `(pred rep list)`
* [`-map-last`](#-map-last-pred-rep-list) `(pred rep list)`
* [`-map-indexed`](#-map-indexed-fn-list) `(fn list)`
* [`-annotate`](#-annotate-fn-list) `(fn list)`
* [`-splice`](#-splice-pred-fun-list) `(pred fun list)`
* [`-splice-list`](#-splice-list-pred-new-list-list) `(pred new-list list)`
* [`-mapcat`](#-mapcat-fn-list) `(fn list)`
* [`-copy`](#-copy-list) `(list)`
### Sublist selection
Functions returning a sublist of the original list.
* [`-filter`](#-filter-pred-list) `(pred list)`
* [`-remove`](#-remove-pred-list) `(pred list)`
* [`-remove-first`](#-remove-first-pred-list) `(pred list)`
* [`-remove-last`](#-remove-last-pred-list) `(pred list)`
* [`-remove-item`](#-remove-item-item-list) `(item list)`
* [`-non-nil`](#-non-nil-list) `(list)`
* [`-slice`](#-slice-list-from-optional-to-step) `(list from &optional to step)`
* [`-take`](#-take-n-list) `(n list)`
* [`-take-last`](#-take-last-n-list) `(n list)`
* [`-drop`](#-drop-n-list) `(n list)`
* [`-drop-last`](#-drop-last-n-list) `(n list)`
* [`-take-while`](#-take-while-pred-list) `(pred list)`
* [`-drop-while`](#-drop-while-pred-list) `(pred list)`
* [`-select-by-indices`](#-select-by-indices-indices-list) `(indices list)`
* [`-select-columns`](#-select-columns-columns-table) `(columns table)`
* [`-select-column`](#-select-column-column-table) `(column table)`
### List to list
Functions returning a modified copy of the input list.
* [`-keep`](#-keep-fn-list) `(fn list)`
* [`-concat`](#-concat-rest-lists) `(&rest lists)`
* [`-flatten`](#-flatten-l) `(l)`
* [`-flatten-n`](#-flatten-n-num-list) `(num list)`
* [`-replace`](#-replace-old-new-list) `(old new list)`
* [`-replace-first`](#-replace-first-old-new-list) `(old new list)`
* [`-replace-last`](#-replace-last-old-new-list) `(old new list)`
* [`-insert-at`](#-insert-at-n-x-list) `(n x list)`
* [`-replace-at`](#-replace-at-n-x-list) `(n x list)`
* [`-update-at`](#-update-at-n-func-list) `(n func list)`
* [`-remove-at`](#-remove-at-n-list) `(n list)`
* [`-remove-at-indices`](#-remove-at-indices-indices-list) `(indices list)`
### Reductions
Functions reducing lists to a single value (which may also be a list).
* [`-reduce-from`](#-reduce-from-fn-init-list) `(fn init list)`
* [`-reduce-r-from`](#-reduce-r-from-fn-init-list) `(fn init list)`
* [`-reduce`](#-reduce-fn-list) `(fn list)`
* [`-reduce-r`](#-reduce-r-fn-list) `(fn list)`
* [`-reductions-from`](#-reductions-from-fn-init-list) `(fn init list)`
* [`-reductions-r-from`](#-reductions-r-from-fn-init-list) `(fn init list)`
* [`-reductions`](#-reductions-fn-list) `(fn list)`
* [`-reductions-r`](#-reductions-r-fn-list) `(fn list)`
* [`-count`](#-count-pred-list) `(pred list)`
* [`-sum`](#-sum-list) `(list)`
* [`-running-sum`](#-running-sum-list) `(list)`
* [`-product`](#-product-list) `(list)`
* [`-running-product`](#-running-product-list) `(list)`
* [`-inits`](#-inits-list) `(list)`
* [`-tails`](#-tails-list) `(list)`
* [`-common-prefix`](#-common-prefix-rest-lists) `(&rest lists)`
* [`-common-suffix`](#-common-suffix-rest-lists) `(&rest lists)`
* [`-min`](#-min-list) `(list)`
* [`-min-by`](#-min-by-comparator-list) `(comparator list)`
* [`-max`](#-max-list) `(list)`
* [`-max-by`](#-max-by-comparator-list) `(comparator list)`
### Unfolding
Operations dual to reductions, building lists from a seed
value rather than consuming a list to produce a single value.
* [`-iterate`](#-iterate-fun-init-n) `(fun init n)`
* [`-unfold
没有合适的资源?快使用搜索试试~ 我知道了~
zipspacemacsfile
共2000个文件
el:1922个
elc:649个
png:402个
需积分: 5 0 下载量 151 浏览量
2022-03-07
21:47:25
上传
评论
收藏 108.6MB ZIP 举报
温馨提示
zipspacemacsfile
资源详情
资源评论
资源推荐
收起资源包目录
zipspacemacsfile (2000个子文件)
# 65B
#d!!workspace!build-numlab-Desktop_Qt_6_2_3_MinGW_64_bit-Debug!Makefile# 35KB
#d!!workspace!build-numlab-Desktop_Qt_6_2_3_MinGW_64_bit-Debug!notepad# 14B
-dolist 164B
-dolist 41B
2.17.0 41B
2.7.0 41B
2.15.0 41B
2.11.0 41B
2.1.0 41B
2.9.0 41B
2.13.0 41B
2.0.0 41B
2.16.0 41B
0.1.0 41B
1.3.0 41B
2.18.0 41B
2.8.0 41B
1.8.0 41B
1.7.0 41B
2.6.0 41B
2.3.0 41B
2.19.0 41B
2.5.0 41B
1.6.0 41B
2.4.0 41B
1.5.0 41B
1.1.0 41B
1.0.0 41B
1.2.0 41B
2.2.0 41B
1.4.0 41B
2.14.0 41B
2.12.0 41B
2.10.0 41B
0blayout 54B
0x0 52B
0xc 48B
attrib.1 385B
create.1 226B
constraint.1 213B
comment.1 190B
using.1 148B
h2.1 130B
hr.1 128B
h1.1 127B
bg.1 85B
inc.1 79B
1.3.1 41B
2.4.1 41B
2.12.1 41B
2.18.1 41B
2.19.1 41B
2.14.1 41B
1.0.1 41B
attrib.2 808B
h1.2 171B
h2.2 171B
using.2 155B
comment.2 149B
hr.2 125B
1.3.2 41B
1.0.2 41B
2.4.2 41B
2048-game 64B
21488-DESKTOP-EVDMUBN~ 248B
2bit 46B
comment.3 206B
1.0.3 41B
2.4.3 41B
4clojure 60B
750words 90B
=b 97B
@ 42B
__call 174B
__callStatic 192B
__contains__ 120B
__enter__ 126B
__exit__ 130B
__getitem__ 125B
__len__ 105B
__new__ 170B
__setitem__ 135B
a 41B
aa-edit-mode 61B
aas 63B
abc-mode 56B
abgaben 50B
abl-mode 62B
abridge-diff 62B
abs-mode 99B
abspath 140B
abyss-theme 65B
ac-alchemist 68B
ac-c-headers 60B
ac-capf 58B
ac-cider 114B
ac-clang 118B
ac-dcd 52B
ac-emacs-eclim 101B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
mengtianwxs
- 粉丝: 303
- 资源: 67
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0