King James Programming

Posts generated by a Markov chain trained on the King James Bible, Structure and Interpretation of Computer Programs, and Why's Poignant Guide to Ruby. Run by Michael Walker (barrucadu).

daniel-r-h asked: All of the programs seem syntactically and semantically valid. Why is that? Is it part of the filtering you do? Are they each stored as one token? Or is it just coincidence?

Tokenisation is done by splitting on spaces, but the sorts of tokens which come up in code samples tend to be very distinct from the sort of tokens which come up elsewhere. Combine that with a prefix of a few tokens, and it’s somewhat likely to just emit code listings verbatim.

Hast thou not heard long ago how I have done all this wickedness: yet turn not aside therefrom to the right form for printing, using

(define (contract-question-mark variable)
   (string-append "?"
                  (if (number? (cadr variable))
                      (string-append (symbol->string (caddr variable))
                                     (number->string (cadr variable)))
                    (symbol->string (cadr variable))))))