Wild Horses, Things, and Creativity

Published on:
Tags: All

Sometimes I want to create something and I run into a limitation or constraint. It is at this point where I am tempted to give up and say that I just can’t do that.

At this time, I remember Maurice Sendak and the origins of Where the Wild Things Are. In this interview with Bill Moyers, he explains how the book was originally titled Where the Wild Horses Are, but he couldn’t draw horses.

She was this torrential woman, passionate woman, who could spot talent 10 miles away. I had no education. I did not go to art school. My drawing was so crude. I had shines on shoes like in Mutt ‘n’ Jeff in Walt Disney. And she saw through that monstrous crudity and cultivated me, really made me grow up. And then, it was time to do my own picture book.

And I came to her with a title that was “Where the Wild Horses Are.” And she just loved that. It was so poetic and evocative. And she gave me a contract based on “Where the Wild Horses Are.” And then, it turned out after some very few months to her chagrin and anger, I couldn’t draw horses. The whole book would have to be full of horses to make the book make sense.

And when I tried a number of things, I remember the acid tones. She said, “Maurice, what can you draw?” Okay. Cause she was investing in a full color picture book. That was an enormous thing back then.

And so, I thought well things, things.

Limits or constraints cannot hold back creativity. But it can help mold it in surprising directions.

How Not to Panic While Writing a Clojure Book

Published on:
Tags: All, Clojure

I made it to that magical moment when the Clojure book I had been working on so long was published and I could actually hold it in my hand.

It was an immense project and I am very happy that it is finally done. Since then, I met some people that are interested in writing books as well. They asked if I had any insights or tips having gone through the process as a first time author. I have collected them in this post in hopes that they will be helpful to those going through the process themselves.

The very first thing to do is to get an outline for your book.

Start with an Outline

Ideas are soft and squishy. They drift into different shapes like clouds, and can melt away just as quickly. One of the hardest things to do was trying to arrange all those ideas in my head into an initial form that would serve as the structure for the entire book. I would pick up a pen and paper, start feeling overwhelmed, and suddenly remember I had something else very pressing to do. I successfully avoided starting a book for quite a while, until one day I cornered myself. I decided that I write my book outline on a long plane flight. With salted peanuts as fuel, and nowhere to escape, I finally wrote an outline. It wasn’t perfect but it was a start and looking back and it was not too far off. Here it is in all of its original roughness.

Title: Living Clojure

From beginning steps to thriving in a functional world

(Each Chapter will follow quotes from Alice in Wonderland and very use ideas from some examples)

Book 1 - Beginner steps

Chapter 1 - Are you comfortable?  Talk about how OO is comfortable but there is another world out there and new way of thinking functionally.
            White Rabbit goes by
Chapter 2 - Forms & Functions - Falling down the rabbit hole
Chapter 3 - Functional Transformations - Growing bigger and smaller - Key to thinking functionally is about transforming data from one shape to another shape.
            Map & Reduce
Chapter 4 - Embracing side effects  - Clojure is impure functional language (The rabbit's glove)  - Cover do and io stuff. Also basic stuff about 
            STM atoms and agents/ Protocols
Chapter 5 - Libraries, Libraries  - - how to use Leiningen
            build system. Where to find clojure libraries, how to use
            Serpents - camel-snake-kebab
Chapter 6 - core.asyc - Tea Party introduction to the core.async library
Chapter 7 - Clojure web - Chesire cat  - introduction to Ring, Cheshire library, ClojureScript and OM 

Book 2 - From here to there - thriving in a functional world

Training plan for thriving in a functional world.

Chapter 8 - Join the community - Surround yourself with other Clojure enthusiats
  - Twitter clojure
  - Github account
  - Clojure mailing list
  - Prismatic clojure news
  - Meetup for local community group.  If there is not one in your area. start one!
  - Attend a Clojure conj

Chatpter 9 - Practice and build up 
Like Couch to 5K 7 week training program to work up to
practicing Clojure

Now that I had an outline. I just needed to figure out how long it would take me to write the book.

However Long You Think It Will Take – You Are Wrong

Having never written a book before, I had no idea how much work it would be. The closest thing I had to compare it to was writing a blog post. I figured writing a chapter would be roughly equivalent to writing a blog post. If I could go back in time, this is the moment where my future self would pour a glass of ice water on my past self. Writing a book is nothing like that. It is a lot of time and work. If I had to compare it now to writing blog posts, the process would be this.

- You write a blog post.
- You rewrite the blog post.
- You write a second blog post.
- You rewrite that blog post and the first one too.
- You write another blog post.
- You rewrite all three post .....

So, if you have to commit to deadlines, make sure you remember how hard it will be, and then double the number.

Speaking of deadlines, they suck, but you should have them.

Make Deadlines

Deadlines are not fun. In fact, deadlines might even be a source of potential panic. But for me, they were necessary evil. There were a few beautiful times when inspiration came knocking at my door and I couldn’t wait to start writing. But most of the time, inspiration was off somewhere else eating biscuits. The only thing that actually moved the book along was me knowing that I needed to get the next chunk done by a certain date.

I found the best thing to do was to set aside a small bit of time on a daily basis to write something.

Routine, Routine, Routine

A daily routine was the most crucial thing for me. Life is really busy with work and family. It is so easy to get overwhelmed with daily life. I decided that mornings would work best for me. So I would stumble in to my computer an hour before work, with a hot cup of tea in hand, and write something. Some days I actually did quite a bit. Other days, I would write one sentence and declare it done. But, I would always do something. Even though those small slices of time didn’t seem like a lot, they added up over the course of a week.

Another curious thing happens when you do something, even a little bit, day after day. You start to get better at it.

Writing is a Different Skill from Coding

I was used to writing code all day. I found that the code writing skills are not the same as writing about code. In fact, I found it really hard to do at the start. But, just like writing code, you get better with practice. And to get better at anything, feedback is really important.

Get and Trust Feedback

After each chapter, I would get feedback from my editor. She was awesome and provided ways for me to improve the experience for the reader. I lost track of how many times I rewrote that first chapter, but each time it would get a bit better and I would improve as well. After the book was about half done it was sent out to others for technical review. They provided feedback not only on the writing style but also the technical content, making sure that it all made sense.

The feedback loop is much slower for writing a book than writing code, but it is just as vital. The great people providing feedback are you closest partners in this. You need to trust them. Especially during the roughest time, the middle of the book.

The Middle Bit is the Hardest

I found the hardest time was about halfway through the book. The initial excitement of the new endeavor had long since worn off. It seemed like such a mountain of a task, with no end in sight. I questioned my decision to continue with it daily. My routine and deadlines kept me moving forward. But my circle of friends and family kept me sane. It was great to have an outlet, not only to vent my frustration with my slow progress, but to get kind encouragement to keep my spirits up.

During these dark days, I also ate cheese.

Celebrate Your Small Victories

At the end of every chapter or deadline I would fix myself a nice plate of cheese and crackers. You have to celebrate the small wins. Cheese is also very tasty.

When the book was finally done. I had a really tasty plate, complete with Stilton, Brie, and a dependable Cheddar. I was incredibly happy to be finished. But I knew that I definitely could have not done it without the help of others.

Thank Everyone that Supported You

Writing a book is a huge undertaking that is utterly impossible to do alone. I could have not done it without the help and support of my editor, reviewers, family, friends, as well as the entire Clojure Community. I am so thankful to all of you that helped my in this project. You are great.

So, should you go ahead and write that book?

Do It

Yes, you should write that book and share your knowledge. Don’t panic, remember to breathe, get some cheese and tea, and go for it! It will be awesome.

Partition With Game of Thrones Pugs

Published on:
Tags: All, Clojure

Clojure’s partition and partition-all functions are very useful. However, I have been bitten a few times using partition when I really wanted partition-all. So to help myself and all of you to remember it, I have made some diagrams with pugs from the Game of Thrones

In code, partition takes a collection and returns a lazy sequence of lists, each containing n items.

To demonstrate this with pugs, we will partition 5 pugs into groups of twos.

This partition will give you two groups of two pugs.

Notice, (and here is the important part), the last pug is missing. The Joffrey pug is not included because partition will not include items that do not make a complete partition. In this case, because there is no group of 2 pugs for the Joffrey pug to be in, it gets dropped.

This is the thing that has bitten me in the past.

A common use for wanting to partition things is to control the number of things that you process at one time. An example of this is sending only 500 items to be processed in a batch job at one time. If you have a few thousand items to be processed, partitioning them is a good way of chuncking. However, if you have an arbitrary number of items, you most certainly want to process them all and not drop any. This is where you should use partition-all instead.

Partition-all chunks the items as well, but also includes any leftovers. Demonstrating again with pugs.

This partition-all will give you three groups of pugs.

This time pug Joffrey is not left out!

Remember, think carefully before using partition. Don’t leave a pug out.

By the way, I can’t wait till the next season of Game of Thrones. Until then ..

Gigasquid’s Radar 2014

Published on:
Tags: All

It’s that time of year for radars to be published. So this year, I thought I would publish one of my own. Here is what is on my radar.


  • Adopt: Clojure – It is fantastic language. Really.
  • Trial: Pixie – The promise of a really fast startup Clojure inspired language. I am impressed already and it is only a few months old.
  • Assess: Idris – I have only seen this lang briefly, but was impressed by the typing and proofing abilities.
  • Hold: JavaScript – I don’t have to say more, you know what I mean.

Cute Animals


  • Adopt: Parrot AR Drone Hackable flying drone with sonar and cameras. Doesn’t injure your fingers too much when you get them caught in the blades.
  • Trial: PhantomX Hexapod A bit pricey and delicate, but built from kit and is super cool when you get it going.
  • Assess: Myo Armband Control things with a flick of your wrist. Mine finally arrived after a year and a half wait. I haven’t had time to play with it, but I have high hopes for it.
  • Hold: Roombas – I love my Roombas, but I am not sure the latest models have an ROI port to hack :(

Tasty Food

  • Adopt: Crumpets – Put lots of butter on them toasted. Yum!
  • Trial: Mint Tim Tams– Minty, just the right amount of crunch. Hard to find in the US, but a treat when you do.
  • Assess: Raclette – I have never actually had it, but it is melted cheese, it has to be incredible.
  • Hold: Egg Nog – Don’t drink it directly from the bowl.

Happy Holidays Everyone!

Clojure FizzBuzz Without Conditionals

Published on:
Tags: All, Clojure

Sure you may have done FizzBuzz before. Maybe you have even done it in Clojure. But have you done it without the use of any conditionals?

As your brain starts to work on the how this we be done, you might be wondering why you should do this in the first place?

There are two very good reasons for this. The first is that it is a kata.

Katas build your code practice

Code katas build your skill through practice. It doesn’t matter if you are a beginner or an expert. Just, like in all those martial arts movies with the swordsman practicing, so must we. We stretch and flex our coding muscles with katas to grow them and keep them in shape.

Yes, you may code every day at work. But it is not the same as kata practice. So much of day to day work involves complexity with large interconnected concerns. Our kata practice cuts the extra complexity out and leaves you alone with a focused small problem.

The second reason involves why you should try it, this time, without conditionals. The answer is creativity.

Constraints build creativity.

It turns out that constraints are a key way to drive creativity. Programming does not only require technical skills, but also creativity. We are seldom asked to build software without constraints. It drives design. Sure, it can be annoying when we have to communicate with a server that is only active on Tuesday and emits its response in Morse Code. But it gives us boundaries to unleash our creative spirit.

So go for it.

Give it a try

Ready? Here are the details.

  • Given a number, if it number is divisible by 3 return “fizz”.
  • If it is divisible by 5 return “buzz”.
  • If it is divisible by 3 and 5 return “fizzbuzz”.
  • Otherwise, just return the number.
  • Don’t use any conditionals like if else case cond.

When you are done, you can check out some of the other solutions. Try not to peek until you have done your version first though.

(There are some really awesome ones so far).

Feel free to link to yours in the comments too :)


From @aderth

From @IamDrowsy

From @Bryanwoods

From @defndaines

From me

From @hyPiRion – a couple of notes for this one is that:

;; -> 0


;; -> 1

And once you think about that, you might want to read this :)

Happy Clojure Kataing!

The Five Stages of Writing a Book

Published on:
Tags: All

  1. Denial: I am not really writing a book.
  2. Anger: Why did I ever decide to write a book?
  3. Bargaining: If I just finish this book, I promise never to write another one.
  4. Depression: I am never going to finish this book.
  5. Resolution: I am writing a book and I am going to give it my frigging all.

Notes and Tips on Working From Home

Published on:
Tags: All

Recently, I switched from a traditional, “go to an office” job, to working from my home. It took some time to setup my home work space and get used to working remotely, but I finally have a system working for me. In this post, I thought I would share some things that I found useful.

Window Seat Please

If at all possible, locate your home work space near a window. The natural light does wonders for you mood and being able to glance up and look at trees and real life is a refreshing break from staring at code all day.

A Door is Great

Having a door to your workspace is a real advantage. It enables you to close off noise and other activity that might be going on in the house. It is also incredibly useful if you have small children. For my kids, if the door is closed, then it is a sign that Mommy is working – do not disturb.

Invest in a good chair.

Backs are very important. I started working from home with just my kitchen chair – big mistake. After a day or two, my back was crying out for something better. I did some research on good chairs to get and I ended up with a Steelcase Leap Chair. They are not cheap. But, I was able to get a refurb one that was considerably less than new, and my back loves it.

Don’t Sit All the Time

Even with my great chair, it is not the best to sit constantly. I had tried a straight standing desk a while back and I found that standing all the time was not the best for me. I prefer to mix it up. I got a adjustable Geek Desk. I generally stand up in the morning and sit in the afternoons.

Freedom from a Headset with a Good Mic

I have used a headset before when doing remote calls. They work fine, but after a while, I found it annoying to have on my head all day. I switched to a Blue Snowball Mic at home and am really happy with it. My voice comes in clear and I am headset free.

Dual Monitors for the Win

I use two Thunderbolt displays. One monitor I use for communications, it has my email, chat, and video on it. The other monitor I use for the codez. It works out pretty well to switch back and forth.

Good Software for Communication

Good communication is a must for working remotely. Someone cannot just wander over to your desk and ask you a question. Here is a list of communication tools I use at work:

  • Slack – for team communication.
  • Google Docs
  • Zoom – for video and screen sharing. It is way better than Google hangouts in terms of video quality.
  • Apple’s Screen sharing – for pair code development. This let’s people use whatever editor they are comfortable with, yet you can see the code and still share control.

Pair Programming is Awesome

At work, we do pair programming most of the time. I really like to work this way. One of the things that I was concerned about in switching to remote work was being lonely. Pair programming really helps in this. I am usually working with someone during the day, with one monitor going with video and voice, while the other monitor has the code we are working on. For me, it has all the advantages of idea sharing and group problem solving. I realize that working this way is not for everyone, but I am digging it.

Routine is Everything

When working for home, I have found it is crucial to have a good routine. Since we do a lot of pair programming at work, we all generally keep the same hours. Being a distributed team over North America, this means I start work at around 10am EST. I have found that having a routine a sticking to it helps structure my day. I get up, get dressed, eat breakfast, just like I was going to work. Then, I usually hack for a bit on personal stuff in the morning until it is time for work. Then at lunch, I go for a run or work out. Finally, and most importantly, in the evening, I leave the computer behind and devote time to family.

Don’t Forget to Visit with Other Humans

The downside of working from home is that it is very easy to not leave home. At one point, I realized that I had not left the house for a week. Not good. I try go to a social event where I will meet with other developers and friends every week. There is a nice developer coffee group that meets on Fridays. I also help run our Cincinnati Functional Programmer’s Group here in town. In general, I find that if I am driving somewhere and see people walking on the street and start thinking, “Look Humans!”, it is time to get out and socialize a bit more. Working remotely, makes going to conferences and being with other developers in person even more fun.

Summary (with a Dog Pic)

I have found working remotely to be quite enjoyable so far. It does take an extra effort to keep your life structured and communication flowing properly, but it is worth it.

My next challenge, since it is getting colder, is to get my dog to sleep on my feet while I work. No luck so far.

If anyone has any tips, let me know.

Green Eggs and Transducers

Published on:
Tags: All, Clojure

A quick tour of Clojure Transducers with core.async with Dr. Seuss as a guide.

Follow along at home by:

  • lein new green-eggs
  • modify your project.clj to include the following:
(defproject green-eggs "0.1.0-SNAPSHOT"
  :description "try them"
  :url "http://en.wikipedia.org/wiki/Green_Eggs_and_Ham"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0-alpha1"]
                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]])
  • Start up a repl and hack in!

Green Eggs and Ham

Transducers are a new feature of Clojure 1.7. Instead of trying to explain them with words, let’s take a look of them in action. First we need some data. Let’s def a vector of all the places you could try green eggs and ham.

(ns green-eggs.core
  (:require [clojure.core.async :as async]))

(def green-eggs-n-ham
  ["in the rain"
   "on a train"
   "in a box"
   "with a fox"
   "in a house"
   "with a mouse"
   "here or there"

Next, let’s create a function that will transform the places into a “I would not eat them …” sentence.

(defn i-do-not-like-them [s]
  (format "I would not eat them %s." s))

(i-do-not-like-them "in the rain")
;; -> "I would not eat them in the rain."

We also need a function to take this result and actually try the green eggs and ham.

(defn try-them [s]
  (clojure.string/replace s  #" not" ""))

(try-them "I would not eat them in the rain.")
;; -> "I would eat them in the rain."

Now we have two transformations that we can apply to the vector of green-eggs-n-ham strings. One of the really nice things about transducers is that you can describe and compose this transformation without a data structure present.

(def sam-i-am-xform
   (map i-do-not-like-them)
   (map try-them)))

We can run the transformation of the transducers against the data in a few ways.

  • into: Non-lazy turn the transformation into a collection
  • sequence: Same thing but lazy
  • transduce: Acts like reduce on the all the transformed elements
  • With core.async channels doing the transformations.

Let’s look at the green eggs and ham example for each one of these ways:


Into takes a transducer and collection to work on and returns the vector we asked for:

(into [] sam-i-am-xform green-eggs-n-ham)
;; -> ["I would eat them in the rain."
;;     "I would eat them on a train."
;;     "I would eat them in a box."
;;     "I would eat them with a fox."
;;     "I would eat them in a house."
;;     "I would eat them with a mouse."
;;     "I would eat them here or there."
;;     "I would eat them anywhere."]


Sequence takes similar arguments, but as promised, returns a lazy sequence that we can interact with.

(class (sequence sam-i-am-xform green-eggs-n-ham))
;; -> clojure.lang.LazyTransformer

(take 1 (sequence sam-i-am-xform green-eggs-n-ham))
;; -> ("I would eat them in the rain.")


If we want to finally arrange all our sentences in the vectors into one string, we would use reduce. The way to do this with transducers is to use transduce. It takes a function of two arguments to perform the reduce, as well as an initial data input.

(transduce sam-i-am-xform #(str %1 %2 " ") "" green-eggs-n-ham)
;; -> "I would eat them in the rain.
;;     I would eat them on a train.
;;     I would eat them in a box.
;;     I would eat them with a fox.
;;     I would eat them in a house.
;;     I would eat them with a mouse.
;;     I would eat them here or there.
;;     I would eat them anywhere."

;;_note: In  1.7.0-alpha2, transduce changed and you need to use a
;;(transduce sam-i-am-xform (completing #(str %1 %2 " ")) "" green-eggs-n-ham)


Core.async has a really nice way to define channels with a transducer that will transform each element on the channel.

(def sam-i-am-chan (async/chan 1 sam-i-am-xform))

Let’s define another channel to reduce the results of the sam-i-am-chan to a string.

(def result-chan (async/reduce #(str %1 %2 " ") "" sam-i-am-chan))

Finally, let’s actually put the green-eggs-n-ham data onto the sam-i-am-chan and let the data transformations flow….

(async/onto-chan sam-i-am-chan green-eggs-n-ham)

At last, we can get our result off the result channel and revel in the beauty of asynchronous data transducers.

(def i-like-them (async/<!! result-chan))

;; -> "I would eat them in the rain.
;;     I would eat them on a train.
;;     I would eat them in a box.
;;     I would eat them with a fox.
;;     I would eat them in a house.
;;     I would eat them with a mouse.
;;     I would eat them here or there.
;;     I would eat them anywhere."

Transducers are elegant and powerful, just like the rest of Clojure. Try them, you will like them :)

The Proper Pronunciation of Clojure’s Assoc

Published on:
Tags: All, Clojure

Sometimes I pause before talking to someone about Clojure code. Not because I am unsure of the code, but because I am unsure of how to pronounce the code. The particular code in question is Clojure’s assoc. I have heard it pronounced two ways. One is “assosh”, the other is “assok”. So, to determine it, I decided to conduct a scientific poll of the Clojure community.

I posted the poll on twitter to the Cojure community who follow me. The control group poll was not viewed by those who do not follow me, and/or, are not on twitter.

The results were startling.

  • assosh – 10
  • assok – 8
  • assose – 2
  • Jeremy – 1
  • asoaksh – 1

The community is clearly deeply divided on this important question.

After sifting through the raw data, I remembered my statistical analysis and threw out the extremes.

The conclusion was still a stark reality.

We do not as a community know how to pronounce assoc.


I can only see one way forward. We must address this as a community. I propose that the community documentation of Clojure Docs and Grimoire modify their sites to include audio pronunciation like this.

Remember, I’m pulling for you. We are all in this together.

Clojure X-Men

Published on:
Tags: All, Clojure

Nobody knows how it happened. Some people think it was due to the rapid expansion and adoption of Clojure. Other people say that the language itself was caused by something deeper and more magical. No one knows for sure. All that we really know is that people starting being born with extraordinary powers. Powers that no human had had before. They were strange and unique to each person they touched. The only thing that they all had in common, was that each was an aspect of the Clojure programming language.

Luke (AKA Lazy Luke)

Luke was a teenager when his powers came to him. His mother always complained that he was lazy. It was true, he did prefer to sleep until noon. He also had a habit of putting everything off to the last minute, like saving all his papers for the night before they were due. One day, though, he noticed something very strange. He could start to see the future. Well not really “see” it. But he could see the infinite possibilities of the future. Not very far into the future, but enough. It was a few milliseconds at first. But now it was up to a full second. He checked the Clojure Docs as soon as he realized his gift. It was lazy evaluation and power to deal with infinite sequences.


Spress, whose real name is Emily, came into her power early. She was only 5 years old. Her mother had taken her to a farm to visit with the animals. Her mother had pointed at the cow and told her daughter that it said “Moo”. Then, at the horse, saying “Neigh”. Spress smiled and pointed at a bucket and said “cow”. Her mother shook her head at her, but Spress only smiled bigger. She said “cow” again. Then, suddenly, the bucket went “Moo”. She was immediately taken to the Clojure X-Men school, where they identified her power as protocols. She trained her power and now is so good at solving the “expression problem”, she is known as “Spress”.


Nobody knows Multi’s background. He came to notice in his early twenties with his powers. Ordinary humans process sensory input, (like sight, touch, and sound), in an asynchronous fashion. However, when it gets processed in the brain, it runs into a single pipeline bottleneck – consciousness. Multi’s power is that he can concurrently process his higher level consciousness and reasoning to all this sensory input. The result is that he can move, think, and perform super fast and in a super smart way. He got the power of Clojure’s concurrency.


Dot always had a way with animals. She had many pets growing up. Later, she would go into the forest and the animals would seek her out. She would be found resting by a tree surrounded by deer and birds. One time, on her walk, she fell down a ditch and had her leg trapped under a log. Her mother arrived, after searching for her, to see a Bear reach down and gently remove the log. She stood dumbfounded, as her daughter thanked the bear and it nodded in reply as it turned away. She could talk with animals effortlessly. She had the power of Clojure’s Interop.


Bob is the leader of the Clojure X-Men. He seeks out people with the power of Clojure and helps train and educate them. He also is the most powerful. He can come into any argument, problem, or challenge and immediately separate out what is most important to focus on. He always knows the right thing to do, without getting bogged down in unnecessary details . His power is Clojure’s simplicity.

There might be others out there, we don’t know. We can only hope, that they are found by Bob and the Clojure X-Men and use their powers for good.