Advertisement
Guest User

Untitled

a guest
Apr 1st, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. ;;Write a function that returns the first non-repetitive
  2. ;;character in a string.
  3. (defn first-duplicate-char [str-in]
  4. (loop [list-Rem (seq str-in) set-Seen (set [])]
  5. (print (type list-Rem) " " list-Rem (next list-Rem) "\n")
  6. (if (= 0 (count str-in))
  7. nil
  8. (if (some #(= (first list-Rem) %) set-Seen)
  9. (first list-Rem)
  10. (recur
  11. (seq (next list-Rem))
  12. (conj set-Seen (first list-Rem)))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement