Enhance code readbility
This commit is contained in:
parent
4a42d616f2
commit
a7af78b86f
1 changed files with 8 additions and 9 deletions
|
@ -8,15 +8,14 @@
|
|||
|
||||
(defun nps-enumerate (data)
|
||||
(check-type data list)
|
||||
(if data
|
||||
(let ((clean-data (remove-if (lambda (x) (or (> x 10) (< x 0))) data)))
|
||||
(unless data (error "Empty DATA list."))
|
||||
(let ((clean-data (remove-if (lambda (x) (or (> x 10) (< x 1))) data)))
|
||||
(loop for score in clean-data
|
||||
counting (>= score 9) into promoters
|
||||
counting (<= score 6) into detractors
|
||||
finally (return (list promoters
|
||||
detractors
|
||||
(length clean-data)))))
|
||||
(error "Empty DATA list.")))
|
||||
(length clean-data))))))
|
||||
|
||||
;;;
|
||||
;;; CALCULATOR
|
||||
|
|
Loading…
Add table
Reference in a new issue