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 [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
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.