Given the following function
(defn proint-down-from [x]
(when (pos? x)
(println x)
(recur (dec x
What role does the ? operator play. It looks like it is creating a
variable name.
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Cloju
Hi,
The ? is merely a convention used to name predicate functions
(ie. functions that return true or false).
It is not enforced, but clojure.core follows it. It's a good idea to follow
it.
I think ruby has a similar convention.
Thanks,
Ambrose
On Thu, May 19, 2011 at 9:09 PM, octopusgrabbus wro
? isn't an operator, it is part of a function's name.
user=> (doc pos?)
-
clojure.core/pos?
([x])
Returns true if num is greater than zero, else false
nil
user=>
Hope that helps!
Alex
On Thu, May 19, 2011 at 8:09 AM, octopusgrabbus
wrote:
> Given the following function
> What role does the ? operator play. It looks like it is creating a
> variable name.
> Thanks.
>
In clojure (and other languages like Ruby) the ? is not an operator, it's
actually part of the function name. Normally ? means that the function
returns a boolean. Think of it as asking a question, s
Hi,
? is not an operator, but part of the name "pos?". pos? is a function, which
returns true if a number is positive, false otherwise.
Function names ending in "?" by convention indicate that they return a
boolean value (true or false). They are called "predicates".
Sincerely
Meikel
PS: In f
Many Thanks. I'm interested in learning Clojure and not everything is
obvious in books.
On May 19, 9:20 am, Meikel Brandmeyer wrote:
> Hi,
>
> ? is not an operator, but part of the name "pos?". pos? is a function, which
> returns true if a number is positive, false otherwise.
>
> Function names e