Pre-West Interview: Gary Fredericks

Free Beginner Workshop

From OO to Clojure Workshop!

Watch my free workshop to help you learn Clojure faster and shift your paradigm to functional.

Talk: Purely Random

Gary Fredericks' talk at Clojure/West is about a functional approach to generating random numbers.


Random number generation (RNG) is typically achieved by using mutable state. And of course, that means they're not great for parallel processing, let alone being generally harder to reason about.

An immutable random number generator returns the next random bytes and a new generator for the next number. A splittable random number generator adds a new function called split, which takes a generator and returns two new generators. It lets you guarantee that the same numbers are generated every time regardless of interleaving.

Haskell's Quickcheck uses splittable random number generators. The talk description states that Clojure's test.check, which is based on Quickcheck, would benefit from splittable random number generators, presumably by allowing for concurrency.

I found an interesting paper about an efficient implementation of Splittable RNGs. Also, the dunaj-project has some interesting work in this area, using java.util.SplittableRandom (Java 8) and Transducers.

About Gary Fredericks

Homepage - GitHub - Twitter

This interview was graciously conducted by Nola Stowe. She's a programmer, the co-founder of DevChix, and a prolific teacher. She recently ran ClojureBridge Austin. Please shout out to her and say thanks!


Gary Fredericks is the next interview participant. He is giving a talk at Clojure/West about Random number generation.

Interview with Gary Fredericks

Nola: How long have you been doing Clojure and how did you get into it?

Gary: I started using Clojure in 2009 at my first full-time software job. The person I reported to was interested in experimenting with new languages.

Nola: What languages did you do before Clojure?

Gary: I learned Clojure in parallel with Ruby, Erlang, and Scala; prior to that I had only programmed as a hobby (TI-BASIC and JavaScript, both due to platform monopoly), for undergrad CS classes (Java), and for a couple minor jobs (both with C++).

Nola: What editor do you use and what is a typical workflow?

Gary: I use emacs with cider, making heavy use of the repl and in-buffer evaluation (especially dedicated scratch files for more serious efforts). I also try to invest in improving my clojure environment via my leiningen profiles and a repl utilities library.

Nola: Can you describe a good use-case for Clojure that you see has an advantage over another language?

Gary: I think Clojure has a pretty general-purpose emphasis. The result is if you buy its value proposition you'll want to use it for a broad range of things, and if you don't you'll probably not want to use it for anything, as the cost of using a less popular language will be too high.

Nola: What is the average airspeed velocity of an unladen Clojure REPL?


$ time echo '(System/exit 0)' | java -jar clojure-1.6.0.jar
Clojure 1.6.0 user=>
real 0m0.928s user 0m1.431s sys 0m0.053s

Nola: Thanks for the interview. It was very informative.