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 being condemned to an extra 
glass of wine being punishment. Hmm.

Jimmie

Stuart Halloway wrote:
> 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 for demo reasons.
>
> Stuart
>
>   
>> 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 predicate. It returns a string. So (if (is-small? x) ..)
>>> is always true! I suspect that the string
>>> produced by is-small? is used somewhere.
>>>
>>> (defn is-small?
>>>  [number]
>>>  (< number 100))
>>>
>>> This would be a predicate since it returns
>>> a Boolean.
>>>
>>> Hope this helps.
>>>
>>> Sincerely
>>> Meikel
>>>       
>> Thanks for the information.
>>
>> That is what I thought. Is it proper or idiomatic Clojure to use a "?"
>> symbol on non-predicate functions?
>>
>> That is somewhat what prompted my question. If a "?" symbol is
>> generally, always or primarily reserved for predicates, it just seemed
>> strange to use a non-predicate example in the book. Especially when  
>> the
>> example could just as easily used  true or false, instead of  yes   
>> or   no.
>>
>> Thanks again.
>>
>> Jimmie

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