Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (require 'cl-ppcre)
- (defparameter *wpm* 300)
- (defparameter *chunk-size* 1)
- (defun tokenize(str)
- (cl-ppcre:split "\\s+" str))
- (defun lines(file)
- (with-open-file (in file
- :direction :input
- :if-does-not-exist :error)
- (loop for line = (read-line in nil)
- while line
- collect line)))
- (defun concat(lst)
- (apply #'concatenate 'string lst))
- (defun read-words(path)
- (tokenize (concat (lines path))))
- (defun wpm-delay(n)
- (/ 60.0 n))
- (defun rsvp(path wpm chunk)
- (let* ((book (read-words path))
- (ch chunk)
- (book-len (length book)))
- (do* ((n 0 (1+ ch))
- (words book (nthcdr ch book)))
- ((>= ch (- book-len n))(print (subseq words n)))
- (print (subseq words n (+ n ch)))
- (sleep (wpm-delay wpm)))))
Add Comment
Please, Sign In to add comment