jq track on Exercism. It had never occurred to me up until that point that as well as being a handy command-line tool for processing JSON,
jq implements a language. It turns out that I had underestimated it, much as I had AWK all those years ago.
Did you know you can use
jq as a simple command-line calculator, for instance?
jq -cn '6 * 7' 42
Or make functions, which help to make filters more legible?
jq -cn ' def double: 2 * . ; [range(10)] | map(double) ' [0,2,4,6,8,10,12,14,16,18]
jq track in a few minutes each day. I also found that I was having a lot of fun with learning the new language and some days I found myself knocking off two or more excercises of an evening just for fun. Putting the “fun” in “functional”, as it were. Soon I found myself at the end of the track with a couple of harder exercises, an evaluator for a very simple subset of Forth and solving the Zebra Puzzle. It took me a couple of sessions to solve each of these but I was happy with how neat the solutions to these problems were in
jq compared with what they might have looked like in some of the languages with which I am more familiar.
I don’t think I’ll be reaching for
jq as my go-to language after this month, but I’ll certainly be able to use it more handily for building reusuable reports based on JSON responses from APIs.
Having accidentally completed the whole
jq track with a few days of the month to go, I revisited Elixir, which I still really, really like as a language.
One more surprise from Functional February? I did most of the exercises in VS Code and I liked the experience so much that I wrote this blog post in it!