[HN Gopher] Knotty: A domain-specific language for knitting patt...
       ___________________________________________________________________
        
       Knotty: A domain-specific language for knitting patterns
        
       Author : todsacerdoti
       Score  : 327 points
       Date   : 2025-09-25 06:13 UTC (16 hours ago)
        
 (HTM) web link (t0mpr1c3.github.io)
 (TXT) w3m dump (t0mpr1c3.github.io)
        
       | willvarfar wrote:
       | 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.
        
         | foofoo12 wrote:
         | 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 wrote:
           | 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 wrote:
             | Worth noting that weaving and knitting are two different
             | production processes.
        
               | bregma wrote:
               | 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 wrote:
               | That's a bit like saying that welding and screwing pieces
               | of metal together are 'essentially identical'.
        
               | bluGill wrote:
               | 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.
        
               | Beijinger wrote:
               | 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
        
           | blahlabs wrote:
           | 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 wrote:
           | they still are. Brother among others make them. You think all
           | those ugly christmas sweaters populating every store in
           | december are all hand knitted?
        
         | yeasku wrote:
         | The Jacquard loom, invented in 1804, introduced a system of
         | punched cards that controlled individual warp threads.
        
         | nvader wrote:
         | 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.
        
         | Syntonicles wrote:
         | 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/
        
       | johnisgood wrote:
       | I am not into kitting at all but the Megaman example is pretty
       | cool. :D
        
       | pwdisswordfishz wrote:
       | Why did I expect a terminal emulator
        
       | russellbeattie wrote:
       | 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 wrote:
         | 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.)
        
       | haunter wrote:
       | Some say the Jacquard machine was the first real computer using
       | punched cards
       | 
       | https://en.wikipedia.org/wiki/Jacquard_machine
        
         | zokier wrote:
         | Some would be wrong. While the use of punch cards was
         | significant, I struggle to see jacquard looms doing
         | _computation_ in any meaningful sense.
        
           | delaminator wrote:
           | Although one could say it is Numerical Control, the precursor
           | to Computerised Numerical Control
        
           | bregma wrote:
           | 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.
        
             | pantulis wrote:
             | > 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 wrote:
               | 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".
        
             | zokier wrote:
             | > 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 wrote:
               | 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 wrote:
               | 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".
        
               | dleeftink wrote:
               | 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.
        
               | bregma wrote:
               | It's not just a computer, it's a _stored program
               | computer_.
               | 
               | What it's not is a _general purpose computer_.
        
           | dleeftink wrote:
           | 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...
        
         | delaminator wrote:
         | 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 wrote:
           | Those systems likely took inspiration from music boxes from
           | long before.
        
         | isolli wrote:
         | 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_ wrote:
         | "Punched cards" tickles me, like "cheesed burger".
        
           | haunter wrote:
           | lol you are right but cheesed burger made me think about
           | those burgers fully dunked into cheese sauce
        
         | eszed wrote:
         | 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.
        
       | James_K wrote:
       | The brackets are the best part of lisp and it utterly confuses me
       | how ready some people are to remove them.
        
       | jimnotgym wrote:
       | The absolute joy of overengineering. This is what we come to hn
       | for
       | 
       | For i = 1:20                  Knitone()             Pearlone()
        
       | flymasterv wrote:
       | This is great, but it's entirely disqualifying that it isn't
       | called Purl.
        
         | artemonster wrote:
         | as always the actual gems are in HN comments :D
        
           | sleepybrett wrote:
           | knotty should be some kind of protocol for getting a tty on a
           | knitting machine.
        
         | dcuthbertson wrote:
         | Oh, the missed opportunities, like a little "ribbing" for the
         | versions :^)
         | 
         | Version 1: Knit
         | 
         | Version 2: Purl
        
       | fudged71 wrote:
       | 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
        
       | unixhero wrote:
       | Isn't knitting a sort of functional programming actually? I read
       | that somewhere.
        
       | jerome-jh wrote:
       | 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/)
        
       | vonStackelberg wrote:
       | Has anyone a recommendation for a good hobby knitting machine?
       | Especially for 3d knitting? Or should I explore the diy projects?
        
       | rirze wrote:
       | TIL, there's a way to use indents to represent S-expressions
       | https://docs.racket-lang.org/sweet/index.html
        
       ___________________________________________________________________
       (page generated 2025-09-25 23:01 UTC)