Re: predicates in Programming Clojure

2009-07-23 Thread Jimmie Houchin
Wow. I wasn't trying to be a trouble maker. :) I was just looking to clarify my understanding and didn't understand the conflict between the definition and example. Unless "?" was idiomatic for things other than predicates. Thanks for the clarification. I have yet to encounter the situation of

Re: predicates in Programming Clojure

2009-07-22 Thread Stuart Halloway
The question mark suffix should be used only for predicates. The author of the erroneous prose is currently being forced to drink an extra glass of wine before bed as punishment. I have *no* idea why I wrote that -- best guess is that is-small? started as a predicate and was later changed f

Re: predicates in Programming Clojure

2009-07-22 Thread Meikel Brandmeyer
Hi, Am 22.07.2009 um 19:35 schrieb Richard Newman: Note that predicates don't necessarily have to return literal true or false: in my opinion at least, it's perfectly reasonable to write (def my-predicate? #{:foo :bar}) -- it'll behave correctly in if and when, but the return value will act

Re: predicates in Programming Clojure

2009-07-22 Thread Richard Newman
> That is what I thought. Is it proper or idiomatic Clojure to use a "?" > symbol on non-predicate functions? I don't think so. The standard library doesn't, at any rate. Note that predicates don't necessarily have to return literal true or false: in my opinion at least, it's perfectly reasona

Re: predicates in Programming Clojure

2009-07-22 Thread Jimmie Houchin
Meikel Brandmeyer wrote: > Hi, > > Am 21.07.2009 um 22:48 schrieb Jimmie Houchin: > >>(defn is-small? [number] >>(if (< number 100) "yes" "no" )) >> >> Is is-small? a predicate? If so, is this a common pattern for such >> predicates? > > The definition is correct. is-small? is not > a p

Re: predicates in Programming Clojure

2009-07-21 Thread Meikel Brandmeyer
Hi, Am 21.07.2009 um 22:48 schrieb Jimmie Houchin: (defn is-small? [number] (if (< number 100) "yes" "no" )) Is is-small? a predicate? If so, is this a common pattern for such predicates? The definition is correct. is-small? is not a predicate. It returns a string. So (if (is-small?

predicates in Programming Clojure

2009-07-21 Thread Jimmie Houchin
Hello, I am very excited about opportunities of what I can do in Clojure. I am a long time Squeaker (Smalltalk), and also Python user, dabbling at times in various other languages. I have briefly explored Scala as an option for my business app. But, I really am a dynamic typing guy. :) I have