Commit bfd0664f authored by Dave Cooper's avatar Dave Cooper
Browse files

added list-of-n-numbers

parent fc6ef0b2
......@@ -144,6 +144,14 @@ was contributed by Reinier van Dijk.
((or (funcall predicate num num2) (< (abs (- num2 num)) tolerance)) (nreverse (cons num2 result-list)))
(push num result-list))))))
(defun list-of-n-numbers (num1 num2 n)
"Returns a list of n numbers equally spaced between bounds num1 and num2, inclusive."
(let ((increment (/ (- num2 num1) (- n 1)))
(result-list nil))
(dotimes (i (- n 1) (nreverse (cons num2 result-list)))
(push (+ num1 (* i increment)) result-list))))
;; FLAG -- remove this when above version is fully tested.
......@@ -187,6 +187,7 @@ If you are interested in this effort we would love to hear from you at open-sour
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment