Warren Wood <warrenthomasw...@yahoo.com> writes:
> Thought of this, which I like better.  Again, I'm surprised if
> conjunction is not already a standard function, but I can't find it.
> I'm still a bit tempted to call it AND for readabilty of code.  (I
> spent some time studying combinatory logic back in the day.  (I even
> had a "Curry Fellowship" at Penn State where Haskell Curry used to
> work.)  Can't remember what combinator letter my "dual" function is.)
>
> (defn dual [x] (fn [f] (f x)))
>
> (defn conjunction [& preds]
>          (fn [x] (every? (dual x) preds)))
>
> (filter
>   (conjunction even? (partial >= 16) (partial <= 9))
>   (range 1 20))

for cases like this you can also leverage reader macros

(filter
  #(and (even? %) (>= 16 %) (<= 9 %))
  (range 1 20))

--
jan

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