Skip to content

Instantly share code, notes, and snippets.

@clyce
Last active December 20, 2015 15:39
Show Gist options
  • Save clyce/6155642 to your computer and use it in GitHub Desktop.
Save clyce/6155642 to your computer and use it in GitHub Desktop.
(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