all 14 comments

sorted by: hot top controversial new old
[–] 12 points 3 months ago* (6 children)
  • [–] 5 points 3 months ago (5 children)

    Thisgreatisone! ?

    If the operands go the other way, I suppose:

    oneisgreatThis!

  • source
  • parent
  • hideshow 5 child comments
  • [–] 4 points 3 months ago* (4 children)

    The stack doesn’t quite work like that. They would get added like this:

    This > buffer
    great, is, one > stack

    Then, each + pulls the latest off the stack and operates.

    First + would pull ‘one’ as it’s the most recent on the stack.

    This page does a good job of explaining: https://www.geeksforgeeks.org/dsa/introduction-to-stack-data-structure-and-algorithm-tutorials/

    Edit: you can also see this reflected in the Alt-text:

    I NOTATION POLISH REVERSE ❤️
    
  • source
  • parent
  • hideshow 4 child comments
  • [–] 4 points 3 months ago* (last edited 3 months ago) (3 children)

    Huh, it's that buffer thing that I didn't know about and isn't mentioned in your link (maybe it's Forth specific?), I use an RPN calculator app, but everything goes on the stack, so "This" would be on the bottom and be popped off last.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 3 months ago (2 children)

    Did Randall get this one wrong?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 3 months ago (5 children)

    But just to nitpick, wouldn't this parse into "Forth ❤️ I"? Which is to say, aren't the operands in the wrong order?

  • source
  • hideshow 5 child comments
  • [–] 4 points 3 months ago (3 children)

    RPN

    data1 data2 function

    Neither Forth nor I are actions.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 3 months ago (2 children)

    That's true, but as the Forth is top of stack I'd read it as the subject and I as the object. OFC that's just how you define the heart-word, but still.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 3 months ago

    The operand at the top of the stack is used as the second operand for binary operators. Second from the top is used as the first operand.

    Here illustrated using dc, and doing the calculation 3 - 1 and printing the answer with the command p, getting the result of 2. As we can see here with a noncommutative operation (subtraction), in order to illustrate the point, we get 2, rather than -2.

    ~ dc
    3 1 - p
    2
    
  • source
  • parent
  • [–] 1 point 3 months ago

    Loved playing with a Forth subset (MUF) in MUD and MUCKs.

  • source