diff options
author | Thanos Apollo <[email protected]> | 2024-03-03 03:40:28 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-03-03 03:40:28 +0200 |
commit | f3f3bc148c4d2221ceb12ef67d14db6e8b8300c7 (patch) | |
tree | f662900b112f3ae9013f9779ddd5176a27c1fe9c | |
parent | 59e91d05df42e92cc55bcf8487ef2eb4239f5704 (diff) |
gnosis-algorithm-next-ef: Fix assertions
-rw-r--r-- | gnosis-algorithm.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gnosis-algorithm.el b/gnosis-algorithm.el index 991a6d1..90ea7d5 100644 --- a/gnosis-algorithm.el +++ b/gnosis-algorithm.el @@ -130,10 +130,11 @@ reviews, increase ef-increase by INCREASE. For every THRESHOLD of C-FAILURES reviews, decrease ef-decrease value by DECREASE." - (cl-loop for (param type) in '((ef listp) (success booleanp) (increase numberp) - (decrease numberp) (threshold numberp)) - do (cl-assert (funcall type (symbol-value param)) nil - "Assertion failed: %s must be of type %s" param type)) + (cl-assert (listp ef) nil "Assertion failed: ef must be a list") + (cl-assert (booleanp success) nil "Assertion failed: success must be a boolean value") + (cl-assert (numberp increase) nil "Assertion failed: increase must be a number") + (cl-assert (numberp decrease) nil "Assertion failed: decrease must be a number") + (cl-assert (numberp threshold) nil "Assertion failed: threshold must be a number") (let ((threshold-p (= (% (max 1 (if success c-successes c-failures)) threshold) 0)) (new-ef (if success (gnosis-algorithm-replace-at-index 2 (+ (nth 2 ef) (nth 0 ef)) ef) (gnosis-algorithm-replace-at-index 2 (max 1.3 (- (nth 2 ef) (nth 1 ef))) ef)))) |