5 comments

  • FarmerPotato4 hours ago
    Forth user here.<p>Don&#x27;t use AI, it writes Forth like it writes C. It has got better at following Standard, in Gforth style, but it is awful at the spirit of Forth: factoring programs into a vocabulary of tiny, reusable pieces.<p>I posted a Forth programming challenge. I was very disappointed to get two AI answers and one human. I think the humans sussed out the solution and described an algorithm to Opus, but, the AI strategy produced one large page-filling word.<p>A top-level word filling one page, doing everything there except some subroutines mimicking C Standard Library.<p>In Forth, that chunk ought to be many smaller words. Heck, even in C (at least it fit in a page.)
  • dharmatech1 hour ago
    How I explore JONESFORTH using a gdb trace file:<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;giLsd-bik6A?si=Cfh5eeWZ2re7ji4C" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;giLsd-bik6A?si=Cfh5eeWZ2re7ji4C</a>
  • vanderZwan10 hours ago
    phreda4 has been doing cool stuff with ColorForth-likes for ages and for some reason barely gets any attention for it. Always brings a smile to my face to see it submitted here
  • tl2do8 hours ago
    Inspired by this article, I tried to read some tutorials on Forth. My question is whether concatenative languages are AI-coding friendly. Apart from the training data availability, the question is also whether LLMs can correctly understand long flows of concatenated operations. Any ideas?
    • crq-yml7 hours ago
      They can produce idioms that resemble the flow of Forth code but when asked to produce a working algorithm, they get lost very quickly because there&#x27;s a combination of reading &quot;backwards&quot; (push order) and forwards (execution order) needed to maintain context. At any time a real Forth program may inject a word into the stack flow that completely alters the meaning of following words, so reading and debugging Forth are nearly the same thing - you have to walk through the execution step by step unless you&#x27;ve intentionally made patterns that will decouple context - and when you do, you&#x27;ve also entered into developing syntax and the LLM won&#x27;t have training data on that.<p>I suggest using Rosetta Code as a learning resource for Forth idioms.
      • tl2do6 hours ago
        Thanks for your reply. In fact, I&#x27;ve grown tired of programming by myself — I do 95% of my coding with Claude Code. But the remaining 5% of bugs can&#x27;t be solved by the AI agent, which forces me to step in myself. In those cases, I&#x27;m thrown into a codebase I&#x27;ve never touched before, and code readability becomes key. That&#x27;s what drew me to this article and to Forth. I would look into the Rosetta.
    • adastra227 hours ago
      Any concatenative program can be reduced to a rho type, and AI are pretty good about combining properly typed abstractions.
      • thesz7 hours ago
        Then you get to definitions like &quot;: open ( string -- handle 1 | 0) ... ;&quot; which describes returning algebraic type <i>Maybe Handle</i> unboxed on the stack. Algebraic types are fun, they can easily represent Peano arithmetic and get us into the realm Goedel incompleteness theorem very quickly.<p>Or you can deduce signature for EXEC EXEC sequence. EXEC&#x27;s stack effect can be described as ( \alpha (\alpha -- \beta) -- \beta), where \greekletter is a placeholder for a stack part of arbitrary length. Notice that this type comment has nested brackets and does not adhere to Forth stack-effect comment convention.<p>When I thought about this more than fifteen years ago, I&#x27;ve got at least two equally valid types for the EXEC EXEC: one where xt at top of stack consumes all its input and leaves no output ( \alpha (\alpha -- \gamma) \beta (\beta -- ) -- \gamma) and when first EXEC produces something for second to execute upon ( \alpha \beta (\beta -- \gamma (\alpha \gamma -- \theta) -- \theta).<p>One can argue that second type of EXEC EXEC subsume first one, if greek-letter-named-stack-parts are allowed to be empty.<p>Still it shows that typing Forth, at the very least, needs unification on the Peano&#x27;s arithmetic level, implementing deduction from length zero to unbounded length.<p>So, in my opinion, for LLM to dependably combine typed Forth&#x2F;concatenative definitions, it needs to call external tool like Prolog to properly deduce type(s) of the sequence of Forth&#x27;s (or concatenative language&#x27;s) definitions.<p>And here we enter a realm interesting in itself.<p>Here it is: <a href="https:&#x2F;&#x2F;github.com&#x2F;stassa&#x2F;louise" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;stassa&#x2F;louise</a><p>This is a Prolog system to learn programs in polynomial time. For one example, it can one-shot-learn a grammar, without being &quot;trained&quot; on millions of samples.<p>So, should one use a LLM that either needs a paid access or just slow to run, or freely go where &quot;old school&quot; systems like Eurisco [1] and Cyc went?<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Eurisko" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Eurisko</a><p>Eurisco demonstrated superhuman abilities in 1982-83. It also demonstrated knowledge transfer at the time, where rules from VLSI place-and-route algorithms were used to design winning Traveler TCS fleet.
    • artemonster6 hours ago
      Concatenation = composition in ultimate form
  • tkdc9269 hours ago
    That is a great looking tutorial. Can&#x27;t wait to try it. Thanks!