In reading R for programmers I saw this function
oddcount <- function(x) {
k <- 0
for (n in x) {
if (n %% 2 == 1) k <- k+1
}
return(k)
}
I would prefer to write it in a simpler style (i.e in lisp)
(defn odd-count [xs]
(count (filter odd? xs)))
I see the function length is equivalent to count and I can write odd? so are there built-in map/filter/remove type functions?