The Algebraic Patent Sewing Machine is a programmable sewing machine that creates patterns on rows of cloth. It is controlled by writing programs that use the following subroutines:
| Subroutine | Description |
| gotoRow(n) | start the sewing machine needle at the left-hand side of row n |
| move(n) | move the needle forward by n cells without producing a pattern |
| shape(s) | produce shape s where s can be 'square' or 'circle' and move the needle to the next cell |
| atEnd() | returns True if the needle is at the end of the row or False otherwise |
For example, if the cloth looks like this to begin with:
The subroutine call gotoRow(2) will place the sewing machine needle at the point shown by the black cross:
The subroutine call move(3) will move the sewing machine needle to the point shown by the black cross:
The subroutine call gotoRow(1) will move the sewing machine needle to the point
shown by the black cross:
The subroutine call shape('square') will draw the following pattern and move the sewing machine needle to the point shown by the black cross:
And finally, the subroutine call shape('circle') will draw the following pattern and move the sewing machine needle to the point shown by the black cross:
All of the previous positions of the sewing machine needle would result in the subroutine call atEnd() returning False, however in the following example atEnd() would return True: