Advertisement
Guest User

Untitled

a guest
Jul 15th, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn max-4-matches
  2.   [s]
  3.   (letfn [(max-4-matches*
  4.        [s c]
  5.        (cond (empty? s) c
  6.          (or (= (nth s 0) \o)
  7.              (= (nth s 0) \x))
  8.          (if (= c 3)
  9.            (+ c 1)
  10.            #(max-4-matches* (next s) (+ c 1)))
  11.          :else
  12.          #(max-4-matches* (next s) 0)))]
  13.     (trampoline max-4-matches* s 0)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement