Hi to everyone,

I'm trying to create a function that takes a simple list and returns the
number of zeros in the list.
So I'm assuming that they will enter a list containing only numbers.
This is what I have so far, but it only works when the list empty. Can
somebody tell me what I'm missing?

(defn count-zeros
  "Returns the numbers of zero in a simple sequence of numbers"
  [list1]
  (cond
    (empty? list1) 0
    (not (zero? (first list1))) 0
    :else
    (recur (+ 1 (count-zeros (rest list1))))))

--Carlos

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