markov-scm/toplevel.scm

34 lines
1.0 KiB
Scheme
Raw Normal View History

2024-09-13 22:48:27 -04:00
(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))
2024-09-14 11:28:56 -04:00
2024-09-13 22:48:27 -04:00
(define (make-a-bible-verse)
(generate-until-word '("startofverse" "startofchapter" "startofbook")))
(define (make-a-book-of-the-bible)
(generate-until-word '("startofbook")))
2024-09-14 11:28:56 -04:00
(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")