Re: Should predicates always have one argument?

2014-02-04 Thread Ryan
Thank you all for your answers, they helped me a lot :) Cheers On Saturday, February 1, 2014 12:10:42 AM UTC+2, Ivan L wrote: > > I typically wrap stuff with (partial) for easier reading. In your example > you might use something like following. > > (defn are-valid > [maps validator] > (let

Re: Should predicates always have one argument?

2014-01-31 Thread Ivan L
I typically wrap stuff with (partial) for easier reading. In your example you might use something like following. (defn are-valid [maps validator] (let [valid? (partial validator)] (map valid? maps))) On Friday, January 31, 2014 11:44:38 AM UTC-5, Ryan wrote: > > Hello, > > I am wonderi

Re: Should predicates always have one argument?

2014-01-31 Thread Tassilo Horn
Andy Fingerhut writes: > contains? every? extends? identical? instance? not-any? not-every? > satisfies? > > That list might not be complete. Just to add some more: =, ==, <, <=, >=, > are also predicates with more than one arg and even no question mark at the end. Bye, Tassilo -- You receive

Re: Should predicates always have one argument?

2014-01-31 Thread John Gabriele
It looks like the `comparator` function wants you to give it a 2-arg predicate. -- John On Friday, January 31, 2014 11:55:30 AM UTC-5, Andy Fingerhut wrote: > > While most of the functions and macros in Clojure core with a ? at the end > take 1 arg, there are several that take two: > > contain

Re: Should predicates always have one argument?

2014-01-31 Thread Jim - FooBar();
A predicate is something that returns true or false. Nothing more nothing less...you can have as many args as you want - it is still a function predicate :) Jim On 31/01/14 16:44, Ryan wrote: Hello, I am wondering if all my predicates should be one argument functions because I run into a c

Re: Should predicates always have one argument?

2014-01-31 Thread Andy Fingerhut
While most of the functions and macros in Clojure core with a ? at the end take 1 arg, there are several that take two: contains? every? extends? identical? instance? not-any? not-every? satisfies? That list might not be complete. But you would not be breaking any traditions I know of to have mu

Should predicates always have one argument?

2014-01-31 Thread Ryan
Hello, I am wondering if all my predicates should be one argument functions because I run into a couple of cases where I needed more than one. For example, I have a function called valid-params? which takes two parameters; the validator to use and a maps parameter. Is this approach wrong/not th