UP | HOME

My latest programming language: knitting
#knitting

Table of Contents

first-hat.jpg

Figure 1: My first knitted hat, a la Charlie Brown

Knitting patterns are one of the oldest forms of software programs. The pattern is analogous to machine code, giving simple instructions that obscure the symmetries and gross structure of the project.

Language constructs

The language is made up of primitives like K, P, K2T, KFB, or SSK which tells the knitter how to knit the next stitch. It also has simple loops like K7, which tells the knitter to knit seven stitches. Breakpoints are added using the primitive PM, or 'place marker', which tells the knitter to stop and refer to the pattern when reaching a marker.

Execution

The 'head' of the knitter scans, from left to right, each symbol in the pattern and executes the required knit. The process is single-threaded and can take anywhere from a single day to months to complete. A running process can be suspended for any amount of time. During execution, the process takes up a considerable amount of memory and may make other background processes like walking or talking more difficult. Debugging is done using a crochet hook, digging into the internals of the running process to fix a misread symbol.

Development

Patterns are developed by experts in the field of knitting. Distribution channels include ravelry.com, magazines, and newspapers. Some programs are open source while others are monetized.

Hardware

The knitter is a mostly self-sustaining computer, independently acquiring energy and skills without any work from the developer. Generally, patterns are cross-platform and work on all knitters except some patterns may include unrecognized primitives. In that case, the knitter will automatically run unit tests in a sandbox called a swatch until execution proceeds smoothly.

Applications

The largest reason for me to learn knitting was that I spend too much time in front of a screen. Knitting is a programming language that requires no electricity to work and is soft on my eyes. I can bring it on planes, car rides, and work on it while I'm tanning in the sun. It's a great, tactile hobby to learn and I can't recommend it enough.