summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShiro Kawai <shiro@acm.org>2024-03-06 23:35:40 -1000
committerShiro Kawai <shiro@acm.org>2024-03-06 23:35:40 -1000
commit24f165549cb9188a38b8c3e7fad585d86b064295 (patch)
treef12dd18cebc08874dd2696cdd8fdfa2be39255fa
parent98c6687a11f83231a2e95da789b776f50c3a056f (diff)
More error checking
-rw-r--r--lib/srfi/194.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/srfi/194.scm b/lib/srfi/194.scm
index 80931cc83..be18b4735 100644
--- a/lib/srfi/194.scm
+++ b/lib/srfi/194.scm
@@ -118,11 +118,14 @@
(define (make-random-char-generator str)
(assume-type str <string>)
+ (assume (not (equal? str "")) "Empty string not allowed")
(samples$ str))
(define (make-random-string-generator k str)
- (assume (exact-integer? k))
+ (assume (and (exact-integer? k) (> k 0))
+ "Length bound must be positive exact integer:" k)
(assume-type str <string>)
+ (assume (not (equal? str "")) "Empty string not allowed")
(strings-of (integers$ k) (samples$ str)))
(define (make-bernoulli-generator p)