On Fri, Dec 5, 2008 at 8:25 AM, MikeM <[EMAIL PROTECTED]> wrote:
> Perhaps the reason to not include it is that the utility of the
> boolean? function is limited. Any value can be used where a clojure
> boolean is expected - any non-nil value is true and nil is false.

But this isn't about looking at a boolean context, it is about testing
whether I'm looking specifically at 'true' or 'false'. The context is
when marshalling a structure into a string for inclusion in an
existing system, where I define

(def *ARGS* {:foo 0 :bar true :baz "hello"})

And want to turn this into a string like:

foo:I:0|bar:B:true|baz:S:hello

Where the type of the argument is encoded as "I" (integer), "B"
(boolean), or "S" string. The function to do this is trivial:

(defn- type2id
  "Generates the appropriate type code for the type of the v"
  [v]
  (cond (integer? v) "I"
        (string? v) "S"
        (boolean? v) "B"))

assuming that the predicate boolean? exists. In my view having this
would make the API more orthogonal, even if its actual use is rather
specialized.

    -tree

-- 
Tom Emerson
[EMAIL PROTECTED]
http://www.dreamersrealm.net/~tree

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to