[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 38d44ed 128/316: Implement --doto
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 38d44ed 128/316: Implement --doto |
Date: |
Mon, 15 Feb 2021 15:57:41 -0500 (EST) |
branch: externals/dash
commit 38d44ed77e634f54daf18dfca09b087764415d75
Author: Ivan Yonchovski <yyoncho@gmail.com>
Commit: Ivan Yonchovski <yyoncho@gmail.com>
Implement --doto
Please let me know if you want me regenerate the docs. When I ran
./create-docs.sh it generates a lot of changes not related to this PR.
---
dash.el | 8 ++++++++
dev/examples.el | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/dash.el b/dash.el
index 066bf7c..550e1b6 100644
--- a/dash.el
+++ b/dash.el
@@ -86,6 +86,14 @@ the target form."
forms)
,retval)))
+(defmacro --doto (eval-initial-value &rest forms)
+ "Anaphoric form of `-doto'.
+Note: `it' is not required in each form."
+ (declare (indent 1))
+ `(let ((it ,eval-initial-value))
+ ,@forms
+ it))
+
(defun -each (list fn)
"Call FN with every item in LIST. Return nil, used for side-effects only."
(--each list (funcall fn it)))
diff --git a/dev/examples.el b/dev/examples.el
index 28e61d7..a250b34 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -1259,7 +1259,12 @@ new list."
(defexamples -doto
(-doto '(1 2 3) (!cdr) (!cdr)) => '(3)
- (-doto '(1 . 2) (setcar 3) (setcdr 4)) => '(3 . 4)))
+ (-doto '(1 . 2) (setcar 3) (setcdr 4)) => '(3 . 4))
+
+ (defexamples --doto
+ (gethash "key"
+ (--doto (make-hash-table :test 'equal)
+ (puthash "key" "value" it))) => "value"))
(def-example-group "Destructive operations" nil
(defexamples !cons
- [elpa] externals/dash b92ab5a 175/316: Merge branch 'zaeph/fix-typo', (continued)
- [elpa] externals/dash b92ab5a 175/316: Merge branch 'zaeph/fix-typo', ELPA Syncer, 2021/02/15
- [elpa] externals/dash eb0a94f 178/316: Update docs after incorporating README.md change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 732d92e 173/316: Remove duplicate definition., ELPA Syncer, 2021/02/15
- [elpa] externals/dash b1bc1bf 181/316: Use correct names of package archives, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f2c0e0d 184/316: Add dash-fontify-mode, ELPA Syncer, 2021/02/15
- [elpa] externals/dash e47ecb8 187/316: Improve --each-while, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 081e10a 192/316: Improve take/drop definitions, ELPA Syncer, 2021/02/15
- [elpa] externals/dash aa76fb3 201/316: Copy-edit README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ac1f66a 215/316: ; Fix omission in last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 8c47f17 038/316: Add function signatures for aliases of built-in functions (#201), ELPA Syncer, 2021/02/15
- [elpa] externals/dash 38d44ed 128/316: Implement --doto,
ELPA Syncer <=
- [elpa] externals/dash 6514359 126/316: Merge pull request #264 from basil-conto/blc/reduce, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 258c324 140/316: Release 2.16.0, ELPA Syncer, 2021/02/15
- [elpa] externals/dash fdf6140 158/316: Merge pull request #322 from wbolster/zip-pair-doc-clarification, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 721436b 168/316: chore: release 2.17.0, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 562084e 171/316: Fix another typo and its copies, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ea4a4cc 172/316: Merge pull request #338 from tarsiiformes/typos, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f800e2e 186/316: Prefer declare forms over lisp-indent-function, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2da2304 188/316: Remove generated manual dash.info, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 713fd6c 193/316: Merge pull request #354 from blc/takedrop, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 770121b 195/316: Update copyright notices with HTTPS links, ELPA Syncer, 2021/02/15