Created
August 9, 2010 05:18
-
-
Save vicalejuri/514976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define 2ndorder-markov | |
(lambda (:phrase) | |
(if (= (length :phrase) 1) (list (first :phrase)) | |
(list (second :phrase))))) | |
(define 3ndorder-markov | |
(lambda (:phrase) | |
(cond | |
((= (length :phrase) 1) (list (first :phrase))) | |
((= (length :phrase) 2) (list (second :phrase))) | |
(else | |
(list (second :phrase) (third :phrase)))))) | |
; Given an phrase and an markov-order function, return a newly trained brain | |
(define teach-phrase | |
(lambda (:phrase :brain *orderfn*) | |
(cond ((null? :phrase) :brain) | |
(else | |
(teach-phrase (cdr :phrase) | |
(alist-cons (first :phrase) (*orderfn* :phrase) :brain) *orderfn*))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment