A computational model of knitting

*I should probably find a way to stop grinning at this, as it's not in fact funny. It's sublime.

*For instance, using this insight, one oughta be able to knit up a giant steel sock pronto using massive reinforced cable and a couple of robotic telephone poles. Laugh at that, eh.

http://www.k2g2.org/blog:bit.craft:computational_model_of_knitting

"A Computational Model of Knitting

"This is the second blog post of the "Towards Computational Craft" series.

"This part is all about the process of knitting as seen through the lens of a computer scientist.

"While the first part was a maifesto for structural rather than procedural knitting instructions, we will now take a look at hand-knitting as computation.

"Storing Stitches

"First off we can observe, that hand knitting needles both have a storage and a stitch processing function. For example when knitting socks, three or more needles may be used, only two of which are operated by the bi-manual human, while the other needles only serve to hold the stitches.

"Abstract Knitting Datatypes (((I want the knitted T-shirt)))

"In terms of their storage function, knitting needles can be regarded as physical implementations of popular computer science concepts, namely the abstract data types referred to as stack and dequeue.

"While straight needles with caps store and retrieve their stitches according to the principle of LIFO (first in - last out), double pointed and circular needles additionally implement the functions of a queue or FIFO (first in – first out), effectively forming a double ended queue, also known as dequeue.

"Knitting Memory

"While the needles constitute the main memory, there is an immense amount of external memory available. Free memory usually takes the form of the yarn ball, whereas allocated memory is constituted by the finished knitwork. Once a stitch is dropped off the needle it is automatically saved to the external memory. Every stitch can be modeled by a data structure with pointers to the subordinate stitches which it holds together.

"Garbage Collection

"There even is an automatic garbage collection accounting for dropped stitches: once the number of superordinate stitches referencing a stitch drops to zero, the whole stitch is dropped altogether, meaning that it is replaced by the null stitch, which only contains references to is neighbors but not to any subordinate stitch. This garbage collection mechanism gives rise to typical avalanche effects, generally known as runs or ladders.

"Stitch Processing

"Flipping Stitches

"To simulate loop formation and the slip-stitch-over operation, frequently encountered in hand knitting, the stack and dequeue functions are slightly extended by simple flip or "loop through" operator...."