Programming in Crochet

Early Roots of Programming

Textiles and programming have a long history together, long before e-textiles entered the picture. An early precursor to modern programming can be found in the Jacquard machine, invented in 1804. It was a programmable loom that could be programmed using strings of punch-cards to weave fabric with complex patterns. An example of the Jacquard machine can be seen in the image below, along with a close up view of the punch-cards. Punch-cards were also used to program early computers.

By User Ghw on en.wikipedia – https://commons.wikimedia.org/w/index.php?curid=1184856

Programming in Crochet Patterns

Crochet (and knitting) patterns are written using a standard notation which describes the precise steps that need to be taken in order to produce a particular design. In a similar manner, computer programs are written in using a standard notation which describes the precise steps that a computer needs to follow in order to solve a problem. Many of the familiar programming constructs can be found in crochet patterns. The example crochet pattern shown below contains the instructions required to produce a small, flat circle:

Terms Used:
ch: chain
sl st: slip stich
tr: treble crochet (UK)
  
Instructions:
ch 4, sl st to first st to form a ring.

Round 1 – ch 3, 11 tr into ring, sl st to first st to top of ch 3 to join (12 stitches).

Round 2 - ch 3, 1 tr in same space, 2 tr in each stitch around, sl st to first st to top of ch 3 to join (24 stitches).
Round 3 - ch 3, 1 tr in same space, 1 tr, *2 tr in next st, 1 tr* repeat 10 times, sl st to first st to top of ch 3 to join (36 stitches).

Round 4 - ch 3, 1 tr in same space, 2 tr *2 tr in next stitch, 2 tr* repeat 10 times, sl st to first st to top of ch 3 to join   (36 stitches).

Fasten off and weave in ends 

Three main programming concepts can be found in crochet patterns:

  • Sequence: a set of instructions that are carried out one at a time in the order they appear.
  • Repetition: a group of instructions that are repeated a set number of times or until a condition is meant.
  • Subroutine: a named block of code that performs a particular task and can be called whenever needed.

The crochet pattern features a set of steps which could be considered a sequence. Additionally, repetition can be seen in Round 3, where there are instructions contained within asterisks (*2 tr in next st, 1 tr*), this group of instructions need to be repeated 10 times. Most programming languages feature pre-defined subroutines that perform common tasks such as calculating an average. These subroutines can be called by name at any point without defining the individuals steps each time. In a similar manner, crochet patterns use pre-defined terms as a shorthand for common stitches. Tr is used to represent the treble crochet stitch and it is assumed that the reader already knows how to perform the treble crochet.

Further Reading

Professional programmers and developers have also commented on the link between programming and crochet, here are just a couple of examples:

Why Coding is Like Crochet

Crochet, Code, Craft

Developers have also been working on writing computer programs to generate crochet patterns, for example:

Modeling Crochet as a Programmer

One thought on “Programming in Crochet

Leave a Reply

Your email address will not be published. Required fields are marked *