Knotty: A domain-specific language for knitting patterns (t0mpr1c3.github.io)

flymasterv 9 hours ago

This is great, but it’s entirely disqualifying that it isn’t called Purl.

artemonster 5 hours ago

as always the actual gems are in HN comments :D

sleepybrett 2 hours ago

knotty should be some kind of protocol for getting a tty on a knitting machine.

willvarfar 14 hours ago

A quick googling says that lego knitting machines have been built. Now it's just to program them! https://www.youtube.com/watch?v=MV19wqtfyF0

Is it only a matter of time before you can get generative AI to create a pattern based on a prompt and then some service mails gift wraps and mails it to you/friend (along with video of the lego machine making it)? Just in time for the holiday season :D

Added: there are lots of internet discussions about how crochet, unlike knitting, cannot be automated. But deeper digging turns up a company called Comez and a company called Taiwan Dahu that seem to make massive industrial ones.

Syntonicles 1 hour ago

I've been curious about knitting & crochet from a programming / robotics / simulation perspective for a while, but deferred it to cut my teeth on simpler problems. Those industrial robots seems to be knitting, not crocheting. They use the term "crochet knitting" as a sales tactic.

This short video is annoying but informative: [1]

The closest I've seen to actual robotic crochet is [2].

Which is exciting and close - but it's hard to overstate its limitations. I took the challenge in that short video seriously and spent 10-20 hours learning basic crochet. It became very clear that replicating my simple test patterns would require vision, planning and modeling capabilities beyond anything I've seen in SOTA surgical robots.

What I find interesting about the post (Knotty) is buried here [3] - apparently it's possible to ditch the grid and create an intuitive representation of the final knit pattern. I suspect that may be doable using traditional algorithms.

[1] https://www.youtube.com/watch?v=EImnSsCadK8

[2] https://www.youtube.com/watch?v=T1-pfeaVsOM

[3] https://stitch-maps.com/about/overview/

foofoo12 13 hours ago

Programmable (punch cards I think) sliding knitting machines were a thing in the past (70s or 80s). They occasionally pop up for free on FB marketplace or little on ebay and such.

Or perhaps you had to flick switches instead of punch cards?

qdw 13 hours ago

Punch-configured textiles go all the way back to the 1700s! The 1804 Jacquard Loom, which used cards, was a big part of the Industrial Revolution and influenced Babbage's Difference Engine and Analytical Engine, both of which use punchcards.

More background: https://en.m.wikipedia.org/wiki/Jacquard_machine

zokier 12 hours ago

Worth noting that weaving and knitting are two different production processes.

Beijinger 7 hours ago

You forgot one, that has no separate English name and will also be translated to knitting. "Wirken".

Also:

Kettenwirken = warp knitting

Kulierwirken oder Flachwirken = weft knitting

Rundstricken = circular knitting

Flachstricken = flat knitting

bregma 11 hours ago

Yes and no. The both involve implementing a sequence of instructions to perform mechanical motions on fiber to form textiles. It might be moving frames to open the shed for weaving, or it might be opening hooks to chain for knitting. The fiber used and the properties of the produced textile may have different properties and the machinery may differ in detail but the processes are essentially identical.

eru 10 hours ago

That's a bit like saying that welding and screwing pieces of metal together are 'essentially identical'.

bluGill 8 hours ago

If you are drawing up blueprints for a machine the two are essentially identical. You choose whichever makes sense for the joint you need, but they are essentially identical on the blueprint.

If you are making the card reader for automated machines, knitting, weaving, and playing a piano are virtually identical - you just move some lever in response to a hole. Someone working on a different part of the machine cares about the difference, but to the card reader they are identical.

blahlabs 10 hours ago

My partners owns numerous brother knitting machines of that era. They are fascinating machines, I love them. Complicated mechanisms to move the needles in and out depending on the pattern set. My partner is the expert in them, not me, so my understanding of how they actually work is limited.

We converted a Brother KH750 (or 950 maybe?) to be able to knit from a digital image with an arduino and a project called All Yarns Are Beautiful [0].

I was going to say unfortunately the project looks dead, but looking at their news page, there is an update from this year after being dormant since 2019, which is exciting.

[0] https://www.ayab-knitting.com/

sleepybrett 6 hours ago

they still are. Brother among others make them. You think all those ugly christmas sweaters populating every store in december are all hand knitted?

nvader 7 hours ago

I have a vision of a device kind of like a pair of scissors, except instead of shears there are two levered attachments: a holder for a needle and a hook to manipulate yarn.

Every time you close and open the handles, it puts one standard knot onto the needle. This could make knitting a row as easy as snip snip snip, but I don't know if it would actually be useful in knitting real projects.

yeasku 7 hours ago

The Jacquard loom, invented in 1804, introduced a system of punched cards that controlled individual warp threads.

jerome-jh 3 hours ago

That's how I like computers: simply useful, down to earth. Congrats to the creator. (BTW reminds me of the wonderful lylipond https://lilypond.org/)

rirze 52 minutes ago

TIL, there's a way to use indents to represent S-expressions https://docs.racket-lang.org/sweet/index.html

haunter 12 hours ago

Some say the Jacquard machine was the first real computer using punched cards

https://en.wikipedia.org/wiki/Jacquard_machine

delaminator 12 hours ago

Like many an invention, he was standing on the shoulders of others

Basile Bouchon (1725) created one of the earliest automated looms using perforated paper tape to control the weaving pattern.

Jean-Baptiste Falcon (1728) improved on Bouchon's design by using chains of punched cards instead of continuous paper tape, making the system more durable and easier to handle.

Jacques Vaucanson (1745) further refined the concept with his own punch card loom design.

Jacquard's breakthrough came in 1804-1805 when he synthesized and perfected these earlier innovations into what became known as the Jacquard loom. His version was more reliable, easier to operate, and became widely adopted - which is why his name became so strongly associated with the technology.

bluGill 8 hours ago

Those systems likely took inspiration from music boxes from long before.

eszed 7 hours ago

There are examples of these in the London Science Museum. I strongly recommend a visit - and not just for those: there's also a (working) full-scale replica of Babbage's difference engine; the entire early history of steam engines (the genuine articles); a duplicating lathe, from the early 19th century; models of the entire history of the (British, at least) tractor; an entire analogue telephone exchange; and way, way, way more. It's a geek's delight. One of my favorite museums ever, but be warned: it took me more than a week's worth of visits to feel like I'd seen it thoroughly.

isolli 11 hours ago

Thanks, I learned something today. If Wikipedia is to be believed:

> He played an important role in the development of the earliest programmable loom (the "Jacquard loom"), which in turn played an important role in the development of other programmable machines, such as an early version of digital compiler used by IBM to develop the modern day computer.

[0] https://en.wikipedia.org/wiki/Joseph_Marie_Jacquard

Dilettante_ 7 hours ago

"Punched cards" tickles me, like "cheesed burger".

haunter 3 hours ago

lol you are right but cheesed burger made me think about those burgers fully dunked into cheese sauce

zokier 12 hours ago

Some would be wrong. While the use of punch cards was significant, I struggle to see jacquard looms doing computation in any meaningful sense.

dleeftink 10 hours ago

Our modern-day nomenclature owes a lot to the 'arrays' and 'threads' that made up these weaving machines (see Howard Rheinhold's Tools for Thought)[0].

Evidently, the punch cards that stored Jacquard's weaving patterns were a direct inspiration for Babbage's analytical engine.

[0]: https://www.rheingold.com/texts/tft/02.html#:~:text=The%20we...

bregma 10 hours ago

From a computer-science theoretic view, any any recursively enumerable transform is computing. It's pretty easy to see the translation between a Jaquard loom and an abstract Turing machine. Just because it smells of machine oil and lanolin instead of ozone and magic smoke doesn't mean an automated loom and a modern computer are not essentially the same device, mathematically speaking.

zokier 9 hours ago

> It's pretty easy to see the translation between a Jaquard loom and an abstract Turing machine

I'm not really seeing that translation, could you expand how you envision that working?

fipar 8 hours ago

What I remember from school (late 90s) is that Babbage was inspired by Jacquard’s punched cards to use then in his Engine, and either this, or Jacquard directly, inspired the same in Hollerith. I don’t recall it as there being a direct line in terms of “modified loom is general purpose computer) but it was certainly an important influence.

In hindsight it seems easy for some of us to make the connection, but, at the time, it must have been quite the breakthrough.

zokier 7 hours ago

I'm not disputing the influence of jacquard machines in general, but there is big difference between "having influence on computing" and "is a computer".

bregma 3 hours ago

It's not just a computer, it's a stored program computer.

What it's not is a general purpose computer.

dleeftink 7 hours ago

It's an interesting question, where the boundaries of an innovation lie. If we take Jacquard's loom as an 'ordinateur' or information ordering machine, its 'computing' properties become more recognisable -- composite outputs and patterns derived from stringing together smaller bits (and strings) of information.

pantulis 10 hours ago

> Just because it smells of machine oil and lanolin instead of ozone and magic smoke

The magic smoke I've smelled before specially with a burnt cap but do computers really smell of ozone???

bregma 3 hours ago

When I was younger I worked with a lot of prototype devices. The lab always had the smell of rosin core and ozone and, from time to time, something worse that resulted in the requirement for a new board. And once, a new desk.

So I guess the answer is "it depends".

delaminator 12 hours ago

Although one could say it is Numerical Control, the precursor to Computerised Numerical Control

vonStackelberg 2 hours ago

Has anyone a recommendation for a good hobby knitting machine? Especially for 3d knitting? Or should I explore the diy projects?

pwdisswordfishz 12 hours ago

Why did I expect a terminal emulator

unixhero 3 hours ago

Isn't knitting a sort of functional programming actually? I read that somewhere.

jimnotgym 10 hours ago

The absolute joy of overengineering. This is what we come to hn for

For i = 1:20

   Knitone()

   Pearlone()
johnisgood 13 hours ago

I am not into kitting at all but the Megaman example is pretty cool. :D

russellbeattie 12 hours ago

You have to admire the full-circle of history about this. Arguably, the first stored programs were created in the 1820s to automate Jacquard looms. The looms used a series of punch cards to automate the weaving of complex patterns. The system helped inspire Charles Babbage's Analytical Engine.

Now 200 years later, we get Knotty. Very satisfying, in a holistic interconnectedness sort of way.

munificent 1 hour ago

As a knitter, I feel compelled to point out that weaving and knitting are very different ways to create textiles. (And crochet is even more different, which is why there are currently no machines that can crochet.)

James_K 11 hours ago

The brackets are the best part of lisp and it utterly confuses me how ready some people are to remove them.

lesser-shadow 13 hours ago

[dead]

Traubenfuchs 13 hours ago

So I was not the only one strongly expecting furry involvement.

fennecbutt 7 hours ago

Ahaha I guess they made a knot joke. Us furries are everywhere seems like.

jasona123 9 hours ago

I mean pixel Gritty is just all over the docs, it was to be expected

spiritplumber 8 hours ago

owo what's this

fudged71 5 hours ago

Most interesting aspects (Notation+DSL) here:

Physical Reality as Type System

- Knitting notation treats physical constraints (yarn direction, needle capacity) as compile-time invariants, not runtime checks

- The notation literally cannot express impossible operations - unlike most programming languages where invalid states are runtime errors

Semantic 2D Syntax

- Spatial positioning encodes operational meaning, not just formatting

- Chart coordinates directly map to fabric coordinates - position IS semantics

- Most programming languages waste the 2D plane on purely aesthetic layout

Context-Dependency That Works

- Heavy context-switching (RS/WS, cable positions) remains manageable because contexts map to physical realities practitioners can feel

- Suggests context-dependent syntax works when contexts correspond to user’s embodied experience

- Contradicts typical CS wisdom that context-dependency is always bad design

Expert Chunking Over Beginner Clarity

- Single symbols encode 4+ sequential operations for expert efficiency

- Notation evolved to optimize pattern recognition for power users, not learning curves

- Inverse of typical programming language priorities (readability over expert speed)

Domain Invariants Enable Multi-Modal Translation

- Knotty’s translation capabilities required modeling yarn physics, not just syntax

- The type system encodes gauge, tension, and material properties as first-class constraints

- Shows DSL success requires modeling domain physics, not just domain vocabulary

Power-Law Feature Adoption

- 10 symbols for basics, 200+ for experts - mirrors programming language feature creep

- But knitting notation maintained backwards compatibility across complexity levels

- Suggests sustainable complexity growth patterns for language design