Knitting and code

This morning I got an e-mail from Femke – with a link to this article knitters and coders – she found it on the Debian-women list)

Knitters get very proficient at reading knitting patterns, which are just varying combinations of k (knits) and p (purls). So the simplest pattern of all, knitting a square, would look something like:

’30k (30 knit stitches), finish the line, then repeat this 20 times’.

A rib would look like: ‘5k, 5p, then repeat this [a certain number of times], then repeat the line [another number of times]’

To a computer scientist or electronic engineer all this looks rather like computer code or, to be precise, like the way of describing a pattern as a computer program.

How your jumper is like coding

So look again at your knitted hat/jumper/cardi and follow the pattern, seeing how it changes horizontally and vertically. Just as knitters give instructions for this in their knitting pattern, coders do the same when writing computer programs. Specifically programmers use things called regular expressions. They are just a standard way to describe patterns.

A project that made the link between code and knitting in a nice way is the Know it all bag, where the knitting pattern has been transformed into code – and where the code displays the knitting pattern in light (patterns and codes with lit/blinking leds). Each time you press the button, the new line of the pattern of your sweater is translated and shown with the leds. This bag does not know all – but it remembers and displays your knitting pattern of a possible complicated sweater…

Thanks F for this article.

This entry was posted in Building, Hack and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.