Skip to content

Commit

Permalink
gen-list and gen-string working
Browse files Browse the repository at this point in the history
  • Loading branch information
mcandre committed Oct 19, 2011
1 parent f26c6bb commit bb0d9d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cluckcheck.scm
@@ -1,3 +1,5 @@
(require-extension srfi-1) ; lists

(define (gen-int)
(random 256))

Expand All @@ -7,4 +9,10 @@
(define (gen-char)
(integer->char (random 128)))

(define (gen-list gen)
(map (lambda (x) (gen)) (iota (random 100))))

(define (gen-string)
(list->string (gen-list gen-char)))

; ...
2 changes: 2 additions & 0 deletions example.scm
Expand Up @@ -13,6 +13,8 @@ exit

(display (format "Random char: ~a\n" (gen-char)))

(display (format "Random string: ~a\n" (gen-string)))

; ...

(exit))

0 comments on commit bb0d9d3

Please sign in to comment.