Hi Wilson, As I'm learning clojure myself, I won't help you with code, but with algo:P 1. you are missing the pred? in my-filter call 2. you are missing the else clause for the if statemant handling situation when first element on the list does not meet the pred? criteria.
I hope this helps. Regards, Bartosz p.s. first post!;-) On Thu, Oct 24, 2013 at 4:51 PM, Wilson <tortugac...@gmail.com> wrote: > I am supposed to make my own filter function without using "remove". I > have this made, but it is not working like it should be working. I don't > have any idea what is wrong with it. Please help me out. For example, if I > give the function the parameters odd? and [1 2 3 4]. It only returns (1), > but it should obviously return (1 3). I don't know why it works like that. > > (defn my-filter [pred? a-seq] > (if (empty? a-seq) > a-seq > (if (pred? (first a-seq)) > (cons (first a-seq) > (my-filter (rest a-seq) '()))))) > > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- Regards Bartosz Kaliszuk bartosz(dot)kaliszuk(at)gmail(dot)com -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.