On Thu, 17 Feb 2011 10:26:05 -0800 (PST)
JMatt <jm...@jmatt.org> wrote:
> On Feb 16, 10:29 pm, Andreas Kostler
> <andreas.koestler.le...@gmail.com> wrote:
> > Is there an easy and idiomatic way of getting the digits of a number in 
> > clojure?
> Here is my attempt at this from a few months ago:

My turn...

(defn to-digits
  "Create a seq of digits from a number."
  [i]
  ^{:user/comment "For Euler Problems (Specifically 16)"}
  (map {\0 0 \1 1 \2 2 \3 3 \4 4 \5 5 \6 6 \7 7 \8 8 \9 9}
       (str  i)))

No assumption about representation here. But my Python background is
showing - Pythons dictionaries are used *everywhere* in the language,
and hence tuned as tightly as possible and thus blasted fast.

    <mike
-- 
Mike Meyer <m...@mired.org>             http://www.mired.org/consulting.html
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

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