[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash cec8c0d 311/316: Rename approx-equal to more accur
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash cec8c0d 311/316: Rename approx-equal to more accurate approx= |
Date: |
Mon, 15 Feb 2021 15:58:23 -0500 (EST) |
branch: externals/dash
commit cec8c0d6850e132ba7f33fbe403cb69e2793879e
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Rename approx-equal to more accurate approx=
* dev/dash-defs.el (approx-equal): Rename...
(approx=): ...to this, to more accurately reflect its function.
All references changed.
* dev/examples.el (-fixfn): Clean up examples.
* README.md:
* dash.texi: Regenerate docs.
---
README.md | 4 ++--
dash.texi | 4 ++--
dev/dash-defs.el | 8 ++++----
dev/examples.el | 16 +++++++++-------
4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index 8d47295..ad0a508 100644
--- a/README.md
+++ b/README.md
@@ -2997,9 +2997,9 @@ cdr the final output from `halt-test`.
In types: (a -> a) -> a -> a.
```el
-(funcall (-fixfn 'cos 'approx-equal) 0.7) ;; ~> 0.7390851332151607
+(funcall (-fixfn #'cos #'approx=) 0.7) ;; ~> 0.7390851332151607
(funcall (-fixfn (lambda (x) (expt (+ x 10) 0.25))) 2.0) ;; =>
1.8555845286409378
-(funcall (-fixfn 'sin 'approx-equal) 0.1) ;; => (halted . t)
+(funcall (-fixfn #'sin #'approx=) 0.1) ;; => (halted . t)
```
#### -prodfn `(&rest fns)`
diff --git a/dash.texi b/dash.texi
index c0e457f..da5dab4 100644
--- a/dash.texi
+++ b/dash.texi
@@ -4527,7 +4527,7 @@ In types: (a -> a) -> a -> a.
@example
@group
-(funcall (-fixfn 'cos 'approx-equal) 0.7)
+(funcall (-fixfn #'cos #'approx=) 0.7)
@result{} 0.7390851332151607
@end group
@group
@@ -4535,7 +4535,7 @@ In types: (a -> a) -> a -> a.
@result{} 1.8555845286409378
@end group
@group
-(funcall (-fixfn 'sin 'approx-equal) 0.1)
+(funcall (-fixfn #'sin #'approx=) 0.1)
@result{} (halted . t)
@end group
@end example
diff --git a/dev/dash-defs.el b/dev/dash-defs.el
index af73bb9..f05fdd2 100644
--- a/dev/dash-defs.el
+++ b/dev/dash-defs.el
@@ -35,14 +35,14 @@ EXPECTED should be the result of evaluating ACTUAL, and OP
is one
of the following comparison operators:
- `=>' ACTUAL should be `equal' to EXPECTED.
-- `~>' ACTUAL should be `approx-equal' to EXPECTED.
+- `~>' ACTUAL should be `approx=' to EXPECTED.
- `!!>' ACTUAL should signal the EXPECTED error,
either an error symbol or an error object.")
(defvar dash--epsilon 1e-15
- "Epsilon used in `approx-equal'.")
+ "Epsilon used in `approx='.")
-(defun approx-equal (u v)
+(defun approx= (u v)
"Like `=', but compares floats within `dash--epsilon'.
This allows approximate comparison of floats to work around
differences in implementation between systems. Used in place of
@@ -56,7 +56,7 @@ differences in implementation between systems. Used in place
of
"Return an ERT assertion form based on EXAMPLE."
(pcase example
(`(,actual => ,expected) `(should (equal ,actual ,expected)))
- (`(,actual ~> ,expected) `(should (approx-equal ,actual ,expected)))
+ (`(,actual ~> ,expected) `(should (approx= ,actual ,expected)))
(`(,actual !!> ,(and (pred symbolp) expected))
;; FIXME: Tests fail on Emacs 24-25 without `eval' for some reason.
`(should-error (eval ',actual ,lexical-binding) :type ',expected))
diff --git a/dev/examples.el b/dev/examples.el
index 307f761..d7d94ce 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -21,7 +21,7 @@
;; so make those good.
;;
;; Use the `~>' symbol instead of `=>' to test the expected and actual
-;; values with `approx-equal'.
+;; values with `approx='.
;;; Code:
@@ -1710,12 +1710,14 @@ for historical reasons, and will soon be absorbed by
`dash'."
(-last-item (-iterate fn init (1+ 5)))))) => t)
(defexamples -fixfn
- ;; Find solution to cos(x) = x (may not converge without fuzzy
comparison)
- (funcall (-fixfn 'cos 'approx-equal) 0.7) ~> 0.7390851332151607
- ;; Find solution to x^4 - x - 10 = 0 (converges using 'equal comparison)
- (funcall (-fixfn (lambda (x) (expt (+ x 10) 0.25))) 2.0) =>
1.8555845286409378
- ;; The sin function has a fixpoint at zero, but it converges too slowly
and is halted
- (funcall (-fixfn 'sin 'approx-equal) 0.1) => '(halted . t))
+ ;; Solve cos(x) = x (may not converge without fuzzy comparison).
+ (funcall (-fixfn #'cos #'approx=) 0.7) ~> 0.7390851332151607
+ ;; Solve x^4 - x - 10 = 0 (converges using `equal' comparison).
+ (funcall (-fixfn (lambda (x) (expt (+ x 10) 0.25))) 2.0)
+ => 1.8555845286409378
+ ;; The sin function has a fixpoint at zero, but it converges too
+ ;; slowly and is halted.
+ (funcall (-fixfn #'sin #'approx=) 0.1) => '(halted . t))
(defexamples -prodfn
(funcall (-prodfn '1+ '1- 'number-to-string) '(1 2 3)) => '(2 1 "3")
- [elpa] externals/dash ee9bceb 284/316: Leave Texinfo docstring indentation as is, (continued)
- [elpa] externals/dash ee9bceb 284/316: Leave Texinfo docstring indentation as is, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a6b16ea 286/316: Localize 'nil -> '() replacement in Texinfo, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 56db327 287/316: Fix printing in Emacs < 27, ELPA Syncer, 2021/02/15
- [elpa] externals/dash d76505d 289/316: Use dash--replace-all in Texinfo format-docstring, ELPA Syncer, 2021/02/15
- [elpa] externals/dash c38b06f 291/316: Port some recent manual changes to README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 47114ca 290/316: Make manual generation more consistent with README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 3fa27c4 295/316: Make README's def-example-group more like manual's, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 4043f4e 305/316: Consolidate duplicated change logs in new NEWS.md, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 51d81a5 308/316: Avoid using dash.el functions in macro bodies, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 41b5681 310/316: Merge pull request #369 from blc/gut, ELPA Syncer, 2021/02/15
- [elpa] externals/dash cec8c0d 311/316: Rename approx-equal to more accurate approx=,
ELPA Syncer <=
- [elpa] externals/dash 4d40317 313/316: Update list of contributors, ELPA Syncer, 2021/02/15
- [elpa] externals/dash be4e939 314/316: ; Fix recent whitespace change in dev/examples.el., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0e97578 316/316: Release dash 2.18.0 and dash-functional 1.3.0, ELPA Syncer, 2021/02/15
- [elpa] externals/dash d98f5a0 235/316: Update for -iota, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0f13e5e 246/316: Prefer push over add-to-list, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 9703eac 249/316: ; Fix Edebug spec in last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 4fb9613 255/316: Avoid evaluating file-local variables, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ff5ed7a 261/316: Extend -keep docs and tests, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 5d8de45 262/316: ; Fix recent typo in -filter & -remove docstrings, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7fc72d9 263/316: Fix Markdown quoting, ELPA Syncer, 2021/02/15