Have you ever used a knitting machine? It has a bed of hooks that the yarn loops around. When the carriage runs over the hooks, it pushes and pulls them while running the yarn across them and forms the stitches. As much as I love hand knitting, these machines are terrific!
It's a finely tuned, complicated unit that does its job quite well. You actually can knit up a sweater in a weekend. I've done it!