Using the Clojure REPL to generate random alphanumeric codes 16 Jan 2012
One of the things that I've really enjoyed about Clojure is experimental coding with the REPL. It's so easy to define functions and experiment with new ideas that I can't believe I didn't use an interactive shell more heavily before.
Fast forward to today, I needed to generate random 10 digit codes for something at work. Previously, I would have quickly written a script in PHP or something, but this time I fired up my Clojure REPL and gave myself a 10 minute timebox to get something done in.
Here's what I came up with:
It only took about three minutes, once I remembered that I could treat strings as sequences.
Again, not rocket science by any means, but having the REPL to solve ad hoc problems is a nice addition to my toolbelt.

