On Wed, Aug 24, 2011 at 5:58 PM, octopusgrabbus
<octopusgrab...@gmail.com> wrote:
> (defn f1
>     [in-seq]
>     (loop [new-seq [] cur-seq in-seq]
>         (if (nil? (first cur-seq))
>             new-seq
>             (if-not (nil? (x-in-seq (first cur-seq) new-seq))
>                 (recur (conj new-seq (first cur-seq)) (rest cur-seq))))))

You don't have a second branch for that last if, so the whole thing
evaluates to nil if there are any duplicates, which there are. You
need an else clause of (recur new-seq (rest cur-seq)).

Or you could just use clojure.core/distinct :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to