projects
/
fiveam.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6753a0
)
Adedd gen-one-element
author
Marco Baringer
<mb@bese.it>
Sat, 8 Apr 2006 10:00:22 +0000
(12:00 +0200)
committer
Marco Baringer
<mb@bese.it>
Sat, 8 Apr 2006 10:00:22 +0000
(12:00 +0200)
src/packages.lisp
patch
|
blob
|
history
src/random.lisp
patch
|
blob
|
history
diff --git
a/src/packages.lisp
b/src/packages.lisp
index
7828de5
..
131dfd5
100644
(file)
--- a/
src/packages.lisp
+++ b/
src/packages.lisp
@@
-51,6
+51,7
@@
#:gen-string
#:gen-list
#:gen-buffer
+ #:gen-one-element
;; running tests
#:run
#:run-all-tests
diff --git
a/src/random.lisp
b/src/random.lisp
index
e869a1c
..
ba0abf8
100644
(file)
--- a/
src/random.lisp
+++ b/
src/random.lisp
@@
-241,5
+241,9
@@
producs objects."
(let ((buffer (make-array (funcall length) :element-type element-type)))
(map-into buffer elements))))
+(defun gen-one-element (&rest elements)
+ (lambda ()
+ (nth (random (length elements)) elements)))
+
;;;; The trivial always-produce-the-same-thing generator is done using
;;;; cl:constantly.