Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gendl
gendl
Commits
bfd0664f
Commit
bfd0664f
authored
Mar 18, 2015
by
Dave Cooper
Browse files
added list-of-n-numbers
parent
fc6ef0b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
base/rest/source/utilities.lisp
View file @
bfd0664f
...
...
@@ -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.
;;
...
...
base/source/package.lisp
View file @
bfd0664f
...
...
@@ -187,6 +187,7 @@ If you are interested in this effort we would love to hear from you at open-sour
#:list-elements
#:list-hash
#:list-of-numbers
#:list-of-n-numbers
#:lookup-color
#:load-quicklisp
#:load-hotpatches
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment