News for hackers. Stuff that matters.
Re:Thinking Forth: A Language and Philosophy for Solving Pro... by kabdib on Wednesday February 07, 2024 @11:35PM (#39298193)
Forth is a charming little language, and I highly recommend spending a few evenings implementing one on the processor of your choice. You'll be astonished at how much functionality will fit in just a few kilobytes. FORTH will teach you no-foolin' hard core pragmatism, and a few dirty tricks that will make you smile.

(That said, I don't like FORTH much at all. The amount of stack-thinking is just agony).

Re:Thinking Forth: A Language and Philosophy for Solving Pro... by zoltar on Thursday February 08, 2024 @12:24AM (#39298560)
There was always something I liked about Forth when I didn't have to do much stack-thinking. One of the things that felt forth-y to me when I first encountered it was threaded code in Clojure (or any other point-free kind of idiom for that matter).

https://santhoshkris.medium.com/threading-macros-in-clojure-...

I'll sometimes abuse Python's compose to do similar things I won't send out for code review. Maybe I really should just try to live in Coconut instead of silly stuff like:

  import chess
  import chess.svg
  from IPython.display import SVG, display
  from functools import reduce
  
  
  def rcompose(*fs):
      return reduce(lambda f, g: lambda *xs, **ys: g(f(*xs, **ys)), fs)
  
  inline_board = rcompose(
          chess.Board,
          chess.svg.board,
          SVG,
          display)

Factor's quotations dealing with stack management weirdness is super nice, too.

https://concatenative.org/wiki/view/Concatenative%20language...

It still has a bit more stack juggling than I like, though. That could just be a "me" problem. Props to that whole community for their effort.

https://www.youtube.com/watch?v=f_0QlhYlS8g

Re:Thinking Forth: A Language and Philosophy for Solving Pro... by timbit42 on Thursday February 08, 2024 @08:40AM (#39301767)
If you're doing a lot of stack-thinking, you're doing it wrong. Perhaps your words are too big and doing too much.