Hey <<First Name>>,
You may have noticed that I haven’t posted anything new about my Chord project, or my Bitcoin full node work-in-progress this week. That’s because I’ve been spending way too much time trying to solve this year’s Advent of Code challenges using the J programming language.
So far, I’ve solved parts one and two of the first eleven puzzles, and I’ve written an article summarizing my solution and thought process for each:
Advent of Code: Chronal Calibration
Advent of Code: Inventory Management System
Advent of Code: No Matter How You Slice It
Advent of Code: Repose Record
Advent of Code: Alchemical Reduction
Advent of Code: Chronal Coordinates
Advent of Code: The Sum of Its Parts
Advent of Code: Memory Maneuver
Advent of Code: The Stars Align
Advent of Code: Marble Mania
Advent of Code: Chronal Charge
I’ve also learned some things about J along the way, which was the whole goal of this challenge.
First and foremost, not all J code is tacit. Before this challenge, I pictured all J code as being densely packed blobs of tacit code that magically wove together computations. The reality is that J code is usually a lot lighter and explicit than that. Tacit code is usually saved for short segments where the terseness or flow of data really fits the pattern. Of course that isn’t always the case…
Following that train of thought, J is intensely procedural. For some reason I always lumped J into the functional family of programming languages. While it’s focus on verb trains and modifying verbs through adverbs definitely has a functional flavor, the bulk of the J code I’ve written is 100% procedural and feels closer to C than something like a LISP, or even Elixir.
While J is procedural, it’s also descriptive. Under the hood, the J runtime/interpreter does a huge amount of work optimizing and performantly executing your expressions. This actually came back to bite me in the “Marble Mania” puzzle, where I basically had to side-step the J way of doing things and build my own circular doubly linked list in memory.
The last thing I’ve learned is that built in data visualization tools are amazingly helpful. J’s viewmat and plot utilities have led me to better solutions and helped me find fixes for subtle bugs in record time. I wish more languages and environments had these kind of out-of-the-box visualization capabilities!
So far, the J experience has definitely been mind-expanding. Painfully so at times. Feel free to check out my Advent of Code Github repository for all of my solutions to date.
What programming language do you think is the biggest brain stretcher? J? Haskell? Something else? Let me know!