Deal of the Day

Home » Main » Manning Forums » 2009 » Clojure in Action

Thread: Filter example seems reversed

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 0 - Pages: 1

Posts: 26
From: US
Registered: 11/11/10
Filter example seems reversed
Posted: Nov 13, 2010 5:26 PM
  Click to reply to this thread Reply

(defn non-zero-expenses [expenses] (filter zero? expenses))

Isn't that going to collect all the zeros? The description of filter suggests so.

Don't you need

(defn non-zero? [x]
(not (zero? x)))

Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor