I am probably missing something fundamental in the following example, which
is trying to remove duplicates from a sequence.
What am I doing wrong?
I call it with (f1 d3).
Thanks.
cmn
(ns test-csv
(:gen-class)
(:use clojure.contrib.command-line)
(:require [clojure.contrib.string :as cstr])
(:use clojure-csv.core))
(def d3 [1 2 3 1 4 1 2])
(defn x-in-seq [x temp-seq]
(if (nil? (some #(= x %) temp-seq))
x))
(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 received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en