34 lines
1.0 KiB
Scheme
34 lines
1.0 KiB
Scheme
(load "markov.chicken.so")
|
|
(import markov)
|
|
|
|
(display "Generating table (this may take a while)\n" (current-error-port))
|
|
(define table (make-table-from-file "kjv.txt"))
|
|
(display "Done generating.\n")
|
|
|
|
(define (generate-until-word* current collected limits)
|
|
(if (member current limits)
|
|
(reverse collected)
|
|
(generate-until-word* (generate-next-word table current)
|
|
(cons current collected)
|
|
limits)))
|
|
|
|
(define (generate-until-word limits)
|
|
(generate-until-word* (generate-next-word table (car limits))
|
|
'()
|
|
limits))
|
|
|
|
|
|
(define (make-a-bible-verse)
|
|
(generate-until-word '("startofverse" "startofchapter" "startofbook")))
|
|
|
|
(define (make-a-book-of-the-bible)
|
|
(generate-until-word '("startofbook")))
|
|
|
|
(define (display-a-book-of-the-bible)
|
|
(display (join-verses (make-a-book-of-the-bible))))
|
|
|
|
(display "Seeding from truly random source...\n")
|
|
(seed-from-entropy)
|
|
(display "Try (make-a-bible-verse) and (display-a-book-of-the-bible).\n")
|
|
|