Functions
This chapter contains reference documentation for the Dash API (Application Programming Interface). The names of all public functions defined in the library are prefixed with a dash character (‘-’).
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.
For instance, while the function -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.
emacs-lisp
;; Normal version.
(-map (lambda (n) (* n n)) '(1 2 3 4))
⇒ (1 4 9 16)emacs-lisp
;; Anaphoric version.
(--map (* it it) '(1 2 3 4))
⇒ (1 4 9 16)The normal version can, of course, also be written as in the following example, which demonstrates the utility of both versions.
emacs-lisp
(defun my-square (n)
"Return N multiplied by itself."
(* n n))
(-map #'my-square '(1 2 3 4))
⇒ (1 4 9 16)