Advertisement
Guest User

Untitled

a guest
Oct 30th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (ns kotitehtava3.core
  2.   (:gen-class))
  3.  
  4. (declare q8)
  5. (declare q7)
  6. (declare q6)
  7. (declare q5)
  8. (declare q4)
  9. (declare q3)
  10. (declare q2)
  11. (declare q1)
  12. (declare q0)
  13.  
  14. (defn q8 [s]
  15.   (if (empty? s)
  16.     true ; this is final state
  17.     (let [x (first s)]
  18.       (case (str x)
  19.         "a" (q7 (rest s))
  20.         "b" (q6 (rest s))
  21.         false))))
  22.  
  23. (defn q7 [s]
  24.   (let [x (first s)]
  25.     (case (str x)
  26.       "a" (q8 (rest s))
  27.       "b" (q3 (rest s))
  28.       false)))
  29.  
  30. (defn q6 [s]
  31.   (let [x (first s)]
  32.     (case (str x)
  33.       "a" (q3 (rest s))
  34.       "b" (q8 (rest s))
  35.       false)))
  36.  
  37. (defn q5 [s]
  38.   (let [x (first s)]
  39.     (case (str x)
  40.       "a" (q2 (rest s))
  41.       "b" (q6 (rest s))
  42.       false)))
  43.  
  44. (defn q4 [s]
  45.   (let [x (first s)]
  46.     (case (str x)
  47.       "a" (q7 (rest s))
  48.       "b" (q1 (rest s))
  49.       false)))
  50.  
  51. (defn q3 [s]
  52.   (let [x (first s)]
  53.     (case (str x)
  54.       "a" (q6 (rest s))
  55.       "b" (q7 (rest s))
  56.       false)))
  57.  
  58. (defn q2 [s]
  59.   (let [x (first s)]
  60.     (case (str x)
  61.       "a" (q5 (rest s))
  62.       "b" (q3 (rest s))
  63.       false)))
  64.  
  65. (defn q1 [s]
  66.   (let [x (first s)]
  67.     (case (str x)
  68.       "a" (q3 (rest s))
  69.       "b" (q4 (rest s))
  70.       false)))
  71.  
  72. (defn q0 [s]
  73.   (let [x (first s)]
  74.     (case (str x)
  75.       "a" (q2 (rest s))
  76.       "b" (q1 (rest s))
  77.       false)))
  78.  
  79. (defn -main
  80.   [& args]
  81.   (println (str (q0 (first args)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement