Live data from Hacker News

Forth

xkcd.com

11–20 of 56 posts

Re: Forth

#12
post #3

Can someone explain for me?

Forth I assume uses reverse polish notation: arguments before the operator. 3 4 + for example, would return 7.

The stack is really a convenience that makes pipeline-driven programming possible in the language.

Re: Forth

#13
Prediction: someone will make a reverse polish notation skill for interacting with claude claiming all sorts of things, like caveman, turn into another markdown as a service company, and make the news.

Re: Forth

#14
post #8

Can someone explain for me?

A different way to say the same: in forth, words get pushed on the stack, and popped from the stack by words that take arguments: code stack I Forth love Forth love I love I Forth ; love presumably pops ; subject, object args ; from stack - and does something ; perhaps prints as side effect

Is that loss?

Re: Forth

#15
I first thought this was some spin on May the fourth be with you. As in how Yoda might say it.

Re: Forth

#16
post #9
post #3

Earlier quoted context omitted.

Forth I assume uses reverse polish notation: arguments before the operator. 3 4 + for example, would return 7.

> would return 7 more pedantically, it would push 7 onto the stack

even more pedantically, would remove 3 and 4 from the stack before pushing 7

Re: Forth

#18
I never noticed the disclaimer at the bottom until today

  xkcd.com is best viewed with Netscape Navigator 4.0 or below on a Pentium 3±1 emulated in Javascript on an Apple IIGS
  at a screen resolution of 1024x1. Please enable your ad blockers, disable high-heat drying, and remove your device
  from Airplane Mode and set it to Boat Mode. For security reasons, please leave caps lock on while browsing.
Also, the font chosen is all caps

Re: Forth

#19
post #8

Can someone explain for me?

A different way to say the same: in forth, words get pushed on the stack, and popped from the stack by words that take arguments: code stack I Forth love Forth love I love I Forth ; love presumably pops ; subject, object args ; from stack - and does something ; perhaps prints as side effect

Here is some inexplicably but meticulously formatted FORTH code that uses right justified indentation! Including reverse polish notation assembley.

https://donhopkins.com/home/code/tomt-cam-forth-scr.txt

https://donhopkins.com/home/code/tomt-users-forth-scr.txt

  ( FMOVE -- functional intersegment move                   ) HEX

  88 CONSTANT *MOV*  ( fn = 0 )   20 CONSTANT *AND*  ( fn = 1 )
  08 CONSTANT  *OR*  ( fn = 2 )   30 CONSTANT *XOR*  ( fn = 3 )

  CODE FMOVE ( fn s.seg s.off d.seg d.off length --)  AX, SI MOV
      CX POP  DI POP  ES POP  SI POP  DS POP  DX POP  AX PUSH
                        AL, # *XOR* MOV  DX, # 3 CMP  1$ JE
                        AL, #  *OR* MOV  DX, # 2 CMP  1$ JE
                        AL, # *AND* MOV  DX, # 1 CMP  1$ JE
                        AL, # *MOV* MOV               1$:
     CS: HERE 5 + , AL MOV  ( modify "[DI], AL MOV" ) 2$:
                      LODS  ES: [DI], AL MOV  DI INC  2$ LOOP
      AX, CS MOV  ES, AX MOV  DS, AX MOV  SI POP  NEXT,  END-CODE

                                                            -->

Re: Forth

#20
post #9

Earlier quoted context omitted.

> would return 7 more pedantically, it would push 7 onto the stack

even more pedantically, would remove 3 and 4 from the stack before pushing 7

Even oddly more pedantically, that's the operand stack, not to be confused with the separate return stack. >R and R> move values between the two stacks.

On the other hand, PostScript also has a dictionary stack, which you can use to implement a Smalltalk-like object oriented programming system. And its data types and executable code are basically polymorphic homoiconic JSON (like Lisp), not raw untyped bytes like FORTH.

https://news.ycombinator.com/item?id=22456471

https://news.ycombinator.com/item?id=47812317

Post reply on HN