Fix some tests

* dev/examples.el (-splice, -iterate): Pacify new unused result
warnings for side-effecting forms.
(-clone): Actually showcase deep -clone, not shallow -copy.  Avoid
modifying constant literal.

* README.md:
* dash.texi: Regenerate docs.
master
Basil L. Contovounesios 3 years ago
parent c30c6bea49
commit b6eef1a24d
No known key found for this signature in database
GPG Key ID: 205AB54A5D5D8CFF
  1. 2
      README.md
  2. 4
      dash.texi
  3. 12
      dev/examples.el

@ -2467,7 +2467,7 @@ replaced with new ones. This is useful when you need to clone a
structure such as plist or alist.
```el
(let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) ;; => (1 2 3)
(let* ((a (list (list 1))) (b (-clone a))) (setcar (car a) 2) b) ;; => ((1))
```
## Threading macros

@ -3714,8 +3714,8 @@ structure such as plist or alist.
@example
@group
(let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b)
@result{} (1 2 3)
(let* ((a (list (list 1))) (b (-clone a))) (setcar (car a) 2) b)
@result{} ((1))
@end group
@end example
@end defun

@ -165,7 +165,7 @@ new list."
;; Test for destructive modification.
(let ((l1 (list 1 2 3))
(l2 (list 4 5 6)))
(--splice (= it 2) l2 l1)
(ignore (--splice (= it 2) l2 l1))
(list l1 l2))
=> '((1 2 3) (4 5 6)))
@ -824,10 +824,10 @@ value rather than consuming a list to produce a single value."
(--iterate nil nil 1) => '(nil)
(--iterate nil nil 2) => '(nil nil)
(--iterate (setq it -1) 1 3) => '(1 -1 -1)
(let (l) (--iterate (push 1 l) (push 0 l) -1) l) => ()
(let (l) (--iterate (push 1 l) (push 0 l) 0) l) => ()
(let (l) (--iterate (push 1 l) (push 0 l) 1) l) => '(0)
(let (l) (--iterate (push 1 l) (push 0 l) 2) l) => '(1 0))
(let (l) (ignore (--iterate (push 1 l) (push 0 l) -1)) l) => ()
(let (l) (ignore (--iterate (push 1 l) (push 0 l) 0)) l) => ()
(let (l) (ignore (--iterate (push 1 l) (push 0 l) 1)) l) => '(0)
(let (l) (ignore (--iterate (push 1 l) (push 0 l) 2)) l) => '(1 0))
(defexamples -unfold
(-unfold (lambda (x) (unless (= x 0) (cons x (1- x)))) 10) => '(10 9 8 7 6 5 4 3 2 1)
@ -2013,7 +2013,7 @@ related predicates."
=> "{elisp-mode : {foo : {bar -> booze}, baz -> qux}, c-mode : {foo -> bla, bum -> bam}}")
(defexamples -clone
(let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) => '(1 2 3)))
(let* ((a (list (list 1))) (b (-clone a))) (setcar (car a) 2) b) => '((1))))
(def-example-group "Threading macros"
"Macros that conditionally combine sequential forms for brevity

Loading…
Cancel
Save