[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 43dcd37 295/439: Only eval NUM in --dotimes once
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 43dcd37 295/439: Only eval NUM in --dotimes once |
Date: |
Tue, 04 Aug 2015 20:29:21 +0000 |
branch: externals/dash
commit 43dcd37d4705b5559eef22635045ab4283ffb2e2
Author: Matus Goljer <address@hidden>
Commit: Matus Goljer <address@hidden>
Only eval NUM in --dotimes once
---
README.md | 2 +-
dash.el | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 7aba5dc..445c41e 100644
--- a/README.md
+++ b/README.md
@@ -1371,7 +1371,7 @@ Returns nil, used for side-effects only.
#### -dotimes `(num fn)`
-Repeatedly calls `fn` (presumably for side-effects) passing in integers from 0
through n-1.
+Repeatedly calls `fn` (presumably for side-effects) passing in integers from 0
through `num-1`.
```cl
(let (s) (-dotimes 3 (lambda (n) (!cons n s))) s) ;; => '(2 1 0)
diff --git a/dash.el b/dash.el
index b38c1d3..9c2a928 100644
--- a/dash.el
+++ b/dash.el
@@ -92,16 +92,18 @@ Returns nil, used for side-effects only."
(put '-each-while 'lisp-indent-function 2)
(defmacro --dotimes (num &rest body)
- "Repeatedly executes BODY (presumably for side-effects) with `it` bound to
integers from 0 through n-1."
+ "Repeatedly executes BODY (presumably for side-effects) with `it` bound to
integers from 0 through NUM-1."
(declare (debug (form body))
(indent 1))
- `(let ((it 0))
- (while (< it ,num)
- ,@body
- (setq it (1+ it)))))
+ (let ((n (make-symbol "num")))
+ `(let ((,n ,num)
+ (it 0))
+ (while (< it ,n)
+ ,@body
+ (setq it (1+ it))))))
(defun -dotimes (num fn)
- "Repeatedly calls FN (presumably for side-effects) passing in integers from
0 through n-1."
+ "Repeatedly calls FN (presumably for side-effects) passing in integers from
0 through NUM-1."
(--dotimes num (funcall fn it)))
(put '-dotimes 'lisp-indent-function 1)
- [elpa] externals/dash 38cd4d2 284/439: Fix fontification when there are dashes, (continued)
- [elpa] externals/dash 38cd4d2 284/439: Fix fontification when there are dashes, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4098ea0 285/439: Merge pull request #74 from YoungFrog/dashfontifix, Phillip Lord, 2015/08/04
- [elpa] externals/dash b075846 287/439: Add -iterate, -unfold, Phillip Lord, 2015/08/04
- [elpa] externals/dash f96196a 289/439: Merge pull request #75 from Fuco1/prefix, Phillip Lord, 2015/08/04
- [elpa] externals/dash 6bdcfa5 286/439: Add -split-on, -split-when, Phillip Lord, 2015/08/04
- [elpa] externals/dash b44140a 288/439: Add -is-prefix/suffix/infix-p, Phillip Lord, 2015/08/04
- [elpa] externals/dash abff641 290/439: Merge pull request #76 from Fuco1/unfold, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8dfa9b6 292/439: Release 2.6.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash f5264db 291/439: Merge pull request #77 from Fuco1/split-when, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5086d24 293/439: Merge pull request #60 from rejeep/cask, Phillip Lord, 2015/08/04
- [elpa] externals/dash 43dcd37 295/439: Only eval NUM in --dotimes once,
Phillip Lord <=
- [elpa] externals/dash 4e6a965 294/439: Still better debug declarations, Phillip Lord, 2015/08/04
- [elpa] externals/dash 703bb59 297/439: Convert -zip to support variable-length arguments, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4ecfea6 296/439: Merge pull request #79 from Fuco1/debug-forms, Phillip Lord, 2015/08/04
- [elpa] externals/dash c08fcba 299/439: Fixed documentation of `-last-item'., Phillip Lord, 2015/08/04
- [elpa] externals/dash c952a54 300/439: Merge pull request #90 from tmalsburg/last-item-doc, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2dfd748 298/439: Merge pull request #87 from steventlamb/topic/make_zip_n_ary, Phillip Lord, 2015/08/04
- [elpa] externals/dash bd85b7c 302/439: Make -zip support infinite (circular) lists, Phillip Lord, 2015/08/04
- [elpa] externals/dash f0dd4cc 301/439: Add -annotate, Phillip Lord, 2015/08/04
- [elpa] externals/dash f780322 305/439: Add `-flatten-n`, Phillip Lord, 2015/08/04
- [elpa] externals/dash fb51f8f 304/439: Merge pull request #88 from steventlamb/topic/zip_cycle_pad, Phillip Lord, 2015/08/04