Guest User

Untitled

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