emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash eef3bb0 023/316: Document -doto macro in the READM


From: ELPA Syncer
Subject: [elpa] externals/dash eef3bb0 023/316: Document -doto macro in the README (#181)
Date: Mon, 15 Feb 2021 15:57:17 -0500 (EST)

branch: externals/dash
commit eef3bb05bdc09cc8f02b748f8d04274ebc74c22d
Author: Mika Vilpas <mika.vilpas@gmail.com>
Commit: Matus Goljer <dota.keys@gmail.com>

    Document -doto macro in the README (#181)
---
 README.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/README.md b/README.md
index 1338ddc..cd8f4b4 100644
--- a/README.md
+++ b/README.md
@@ -277,6 +277,7 @@ Functions iterating over lists for side-effect only.
 * [-each-while](#-each-while-list-pred-fn) `(list pred fn)`
 * [-each-indexed](#-each-indexed-list-fn) `(list fn)`
 * [-dotimes](#-dotimes-num-fn) `(num fn)`
+* [-doto](#-doto-eval-initial-value-rest-forms) `(eval-initial-value &rest 
forms)`
 
 ### Destructive operations
 
@@ -2191,6 +2192,18 @@ Repeatedly calls `fn` (presumably for side-effects) 
passing in integers from 0 t
 (let (s) (--dotimes 5 (!cons it s)) s) ;; => '(4 3 2 1 0)
 ```
 
+#### -doto `(eval-initial-value &rest forms)`
+
+Eval a form, then insert that form as the 2nd argument to other forms.
+The `eval-initial-value` form is evaluated once. Its result is
+passed to `forms`, which are then evaluated sequentially. Returns
+the target form.
+
+```el
+(-doto '(1 2 3) (!cdr) (!cdr)) ;; => '(3)
+(-doto '(1 . 2) (setcar 3) (setcdr 4)) ;; => '(3 . 4)
+```
+
 
 ## Destructive operations
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]