[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash ce4a344 258/316: Eliminate odd? from examples
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash ce4a344 258/316: Eliminate odd? from examples |
Date: |
Mon, 15 Feb 2021 15:58:12 -0500 (EST) |
branch: externals/dash
commit ce4a34422945ac65bd2600e13b8c18f21117e32d
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Eliminate odd? from examples
* dev/examples.el (odd?): Remove function.
(-drop-while, -partition-after-pred, -partition-before-pred)
(-each-while, -each-r-while): Replace odd? with built-in
functions (#342).
* README.md:
* dash.texi: Regenerate docs.
---
README.md | 16 ++++++++--------
dash.texi | 28 ++++++++++++++--------------
dev/examples.el | 29 ++++++++++++++---------------
3 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/README.md b/README.md
index 91e31bc..d355116 100644
--- a/README.md
+++ b/README.md
@@ -1509,9 +1509,9 @@ other value (the body).
Partition directly after each time `pred` is true on an element of `list`.
```el
-(-partition-after-pred #'odd? '()) ;; => '()
-(-partition-after-pred #'odd? '(1)) ;; => '((1))
-(-partition-after-pred #'odd? '(0 1)) ;; => '((0 1))
+(-partition-after-pred #'booleanp '()) ;; => '()
+(-partition-after-pred #'booleanp '(t t)) ;; => '((t) (t))
+(-partition-after-pred #'booleanp '(0 0 t t 0 t)) ;; => '((0 0 t) (t) (0 t))
```
#### -partition-before-pred `(pred list)`
@@ -1519,9 +1519,9 @@ Partition directly after each time `pred` is true on an
element of `list`.
Partition directly before each time `pred` is true on an element of `list`.
```el
-(-partition-before-pred #'odd? '()) ;; => '()
-(-partition-before-pred #'odd? '(1)) ;; => '((1))
-(-partition-before-pred #'odd? '(0 1)) ;; => '((0) (1))
+(-partition-before-pred #'booleanp '()) ;; => '()
+(-partition-before-pred #'booleanp '(0 t)) ;; => '((0) (t))
+(-partition-before-pred #'booleanp '(0 0 t 0 t t)) ;; => '((0 0) (t 0) (t) (t))
```
#### -partition-before-item `(item list)`
@@ -2686,7 +2686,7 @@ Its anaphoric counterpart is `--each-while`.
```el
(let (l) (-each-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) ;; => '(4
2)
(let (l) (--each-while '(1 2 3 4) (< it 3) (push it l)) l) ;; => '(2 1)
-(let ((s 0)) (--each-while '(1 3 4 5) (odd? it) (setq s (+ s it))) s) ;; => 4
+(let ((s 0)) (--each-while '(1 3 4 5) (< it 5) (setq s (+ s it))) s) ;; => 8
```
#### -each-indexed `(list fn)`
@@ -2725,7 +2725,7 @@ Its anaphoric counterpart is `--each-r-while`.
```el
(let (l) (-each-r-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) ;; =>
'(6)
(let (l) (--each-r-while '(1 2 3 4) (>= it 3) (push it l)) l) ;; => '(3 4)
-(let ((s 0)) (--each-r-while '(1 2 3 5) (odd? it) (setq s (+ s it))) s) ;; => 8
+(let ((s 0)) (--each-r-while '(1 2 3 5) (> it 1) (setq s (+ s it))) s) ;; => 10
```
#### -dotimes `(num fn)`
diff --git a/dash.texi b/dash.texi
index ba418e1..a37ab85 100644
--- a/dash.texi
+++ b/dash.texi
@@ -2188,16 +2188,16 @@ Partition directly after each time @var{pred} is true
on an element of @var{list
@example
@group
-(-partition-after-pred #'odd? '())
+(-partition-after-pred #'booleanp '())
@result{} '()
@end group
@group
-(-partition-after-pred #'odd? '(1))
- @result{} '((1))
+(-partition-after-pred #'booleanp '(t t))
+ @result{} '((t) (t))
@end group
@group
-(-partition-after-pred #'odd? '(0 1))
- @result{} '((0 1))
+(-partition-after-pred #'booleanp '(0 0 t t 0 t))
+ @result{} '((0 0 t) (t) (0 t))
@end group
@end example
@end defun
@@ -2208,16 +2208,16 @@ Partition directly before each time @var{pred} is true
on an element of @var{lis
@example
@group
-(-partition-before-pred #'odd? '())
+(-partition-before-pred #'booleanp '())
@result{} '()
@end group
@group
-(-partition-before-pred #'odd? '(1))
- @result{} '((1))
+(-partition-before-pred #'booleanp '(0 t))
+ @result{} '((0) (t))
@end group
@group
-(-partition-before-pred #'odd? '(0 1))
- @result{} '((0) (1))
+(-partition-before-pred #'booleanp '(0 0 t 0 t t))
+ @result{} '((0 0) (t 0) (t) (t))
@end group
@end example
@end defun
@@ -4059,8 +4059,8 @@ Its anaphoric counterpart is @code{--each-while}.
@result{} '(2 1)
@end group
@group
-(let ((s 0)) (--each-while '(1 3 4 5) (odd? it) (setq s (+ s it))) s)
- @result{} 4
+(let ((s 0)) (--each-while '(1 3 4 5) (< it 5) (setq s (+ s it))) s)
+ @result{} 8
@end group
@end example
@end defun
@@ -4128,8 +4128,8 @@ Its anaphoric counterpart is @code{--each-r-while}.
@result{} '(3 4)
@end group
@group
-(let ((s 0)) (--each-r-while '(1 2 3 5) (odd? it) (setq s (+ s it))) s)
- @result{} 8
+(let ((s 0)) (--each-r-while '(1 2 3 5) (> it 1) (setq s (+ s it))) s)
+ @result{} 10
@end group
@end example
@end defun
diff --git a/dev/examples.el b/dev/examples.el
index 76f4b20..56e95da 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -36,7 +36,6 @@
;; FIXME: These definitions ought to be exported along with the
;; examples, if they are going to be used there.
-(defun odd? (num) (= 1 (% num 2)))
(defun even? (num) (= 0 (% num 2)))
(defun square (num) (* num num))
@@ -291,7 +290,7 @@ new list."
(--drop-while nil '(1 2)) => '(1 2)
(--drop-while t '(1)) => ()
(--drop-while t '(1 2)) => ()
- (let ((l (list 1 2))) (setcar (-drop-while #'odd? l) 0) l) => '(1 0)
+ (let ((l (list t 2))) (setcar (-drop-while #'booleanp l) 0) l) => '(t 0)
(let ((l (list 1 2))) (eq (--drop-while nil l) l)) => t)
(defexamples -select-by-indices
@@ -761,19 +760,19 @@ value rather than consuming a list to produce a single
value."
(-partition-by-header 'even? '(2 1 1 1 4 1 3 5 6 6 1)) => '((2 1 1 1) (4 1
3 5) (6 6 1)))
(defexamples -partition-after-pred
- (-partition-after-pred #'odd? '()) => '()
- (-partition-after-pred #'odd? '(1)) => '((1))
- (-partition-after-pred #'odd? '(0 1)) => '((0 1))
- (-partition-after-pred #'odd? '(1 1)) => '((1) (1))
- (-partition-after-pred #'odd? '(0 0 0 1 0 1 1 0 1)) => '((0 0 0 1) (0 1)
(1) (0 1)))
+ (-partition-after-pred #'booleanp '()) => '()
+ (-partition-after-pred #'booleanp '(t t)) => '((t) (t))
+ (-partition-after-pred #'booleanp '(0 0 t t 0 t)) => '((0 0 t) (t) (0 t))
+ (-partition-after-pred #'booleanp '(t)) => '((t))
+ (-partition-after-pred #'booleanp '(0 t)) => '((0 t)))
(defexamples -partition-before-pred
- (-partition-before-pred #'odd? '()) => '()
- (-partition-before-pred #'odd? '(1)) => '((1))
- (-partition-before-pred #'odd? '(0 1)) => '((0) (1))
- (-partition-before-pred #'odd? '(1 1)) => '((1) (1))
- (-partition-before-pred #'odd? '(0 1 0)) => '((0) (1 0))
- (-partition-before-pred #'odd? '(0 0 0 1 0 1 1 0 1)) => '((0 0 0) (1 0)
(1) (1 0) (1)))
+ (-partition-before-pred #'booleanp '()) => '()
+ (-partition-before-pred #'booleanp '(0 t)) => '((0) (t))
+ (-partition-before-pred #'booleanp '(0 0 t 0 t t)) => '((0 0) (t 0) (t)
(t))
+ (-partition-before-pred #'booleanp '(t)) => '((t))
+ (-partition-before-pred #'booleanp '(t t)) => '((t) (t))
+ (-partition-before-pred #'booleanp '(0 t 0)) => '((0) (t 0)))
(defexamples -partition-before-item
(-partition-before-item 3 '()) => '()
@@ -1525,7 +1524,7 @@ value rather than consuming a list to produce a single
value."
(defexamples -each-while
(let (l) (-each-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) =>
'(4 2)
(let (l) (--each-while '(1 2 3 4) (< it 3) (push it l)) l) => '(2 1)
- (let ((s 0)) (--each-while '(1 3 4 5) (odd? it) (setq s (+ s it))) s) => 4
+ (let ((s 0)) (--each-while '(1 3 4 5) (< it 5) (setq s (+ s it))) s) => 8
(let (s) (-each-while () (lambda (_) t) (lambda (_) (setq s t))) s) => nil
(let (s) (--each-while () t (setq s t)) s) => nil
(let (s) (--each-while '(1) t (setq s it)) s) => 1
@@ -1552,7 +1551,7 @@ value rather than consuming a list to produce a single
value."
(defexamples -each-r-while
(let (l) (-each-r-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) =>
'(6)
(let (l) (--each-r-while '(1 2 3 4) (>= it 3) (push it l)) l) => '(3 4)
- (let ((s 0)) (--each-r-while '(1 2 3 5) (odd? it) (setq s (+ s it))) s) =>
8
+ (let ((s 0)) (--each-r-while '(1 2 3 5) (> it 1) (setq s (+ s it))) s) =>
10
(let (s) (-each-r-while () (lambda (_) t) (lambda (_) (setq s t))) s) =>
nil
(let (s) (--each-r-while () t (setq s t)) s) => nil
(let (s) (--each-r-while '(1) t (setq s it)) s) => 1
- [elpa] externals/dash 1ccf08d 244/316: ; Fix last change, (continued)
- [elpa] externals/dash 1ccf08d 244/316: ; Fix last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2625bc5 247/316: Don't use insert-file-contents-literally, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7583e65 248/316: Revert --map to using mapcar, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 6f5888c 251/316: Extend --filter and --remove docs and tests, ELPA Syncer, 2021/02/15
- [elpa] externals/dash db45ee7 252/316: Optimize -remove-first a bit, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0e5acda 260/316: Simplify -non-nil, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 9ad0d2b 266/316: Extend -map-indexed docs and tests, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f61769d 256/316: * dash.el (dash--keywords): Prefer rx., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2aeb4e4 264/316: Use actual advertised function signature in README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a536770 267/316: Prefer relative image links in README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ce4a344 258/316: Eliminate odd? from examples,
ELPA Syncer <=
- [elpa] externals/dash f3ae7bb 259/316: Alias -remove-item to remove, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 525ede2 265/316: Improve docstring Markdown formatting, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 4a32a5d 257/316: Write -remove-last in terms of --remove-last, ELPA Syncer, 2021/02/15
- [elpa] externals/dash cbd3b29 268/316: * .elpaignore: Exclude dev/ from GNU ELPA tarball., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 2a10547 271/316: Fix handling nils of -some-->, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0789fd0 273/316: Fix -some--> docstring and Edebug spec, ELPA Syncer, 2021/02/15
- [elpa] externals/dash e0254c5 274/316: * dash.el (-doto): Fix Edebug spec., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 46e43c0 277/316: Fix long-standing typo in Texinfo generation, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 65eeaf6 278/316: Fix long-standing typo in examples, ELPA Syncer, 2021/02/15
- [elpa] externals/dash dbbf617 281/316: Remove dead code from examples-to-info.el, ELPA Syncer, 2021/02/15