Hi,

no, it's not. The cons is in the tail position. Here a working version.

(defn rember
  [a l]
  (loop [ret []
         lat (seq l)]
    (cond
      (not lat)         ret
      (= (first lat) a) (recur ret (next lat))
      :else             (recur (conj ret (first lat)) (next lat)))))

Note, how recur is now in the tail position and how an accumulator is used 
to collect the results.

Hope that helps.

Sincerely
Meikel

BTW: you can also use direct recursion in your original function instead of 
recur by simply calling the function (rember) itself again.

-- 
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