-
-
Save clyce/6155642 to your computer and use it in GitHub Desktop.
This file contains 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
(declare S U V Q) | |
(defn S [x] ;Start Status | |
(case x :a U :b V)) | |
(defn U [x] | |
(case x :a Q :b V)) | |
(defn V [x] | |
(case x :a U :b Q)) | |
(defn Q [x] ;End Status | |
Q) | |
(defn judge [coll] | |
(loop [reading (first coll) | |
right-hand (rest coll) | |
current-status S] | |
(if (empty? right-hand) | |
(= current-status Q) | |
(recur (first right-hand) | |
(rest right-hand) | |
(current-status reading))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment