On Wed, Oct 21, 2009 at 10:51 AM, Lauri Pesonen <lauri.peso...@iki.fi>wrote:

> One way to fix this would be to produce a string out of c:
>
> (defn hexchar? [c] (re-find #"[0-9A-Fa-f]" (str c)))
>
> but you should really change hexchar? into something more elegant.


Like this?

(def hexchar? #{\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 \A \a \B \b \C \c \D \d \E \e
\F \f})

(defn hex? [s] (every? hexchar? s))

user=> (hex? "490fdc1b")
true
user=> (hex? "490qdc1b")
nil

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