Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;Write a function that returns the first non-repetitive
- ;;character in a string.
- (defn first-duplicate-char [str_in]
- (loop [list_Rem (seq str_in) set_Seen (set [])]
- (print (type list_Rem) " " list_Rem (next list_Rem) "\n")
- (if (= 0 (count str_in))
- nil
- (if (some #(= (first list_Rem) %) set_Seen)
- (first list_Rem)
- (recur
- (seq (next list_Rem))
- (conj set_Seen (first list_Rem)))))))
Advertisement
Add Comment
Please, Sign In to add comment