Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn max-4-matches
- [s]
- (letfn [(max-4-matches*
- [s c]
- (cond (empty? s) c
- (or (= (nth s 0) \o)
- (= (nth s 0) \x))
- (if (= c 3)
- (+ c 1)
- #(max-4-matches* (next s) (+ c 1)))
- :else
- #(max-4-matches* (next s) 0)))]
- (trampoline max-4-matches* s 0)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement