Skip to content

Comment on Try Forth

Comments

Errr... what's the word for printing the top of the stack? Or some way of getting a result back out?

. It does drop the top of the stack, too, though.

So, to compute and print 1001, do:

7 11 13 * * .

Also useful: .s non-destructively prints the stack (as does .S ; this forth does appear to be case-insensitive)

Thanks! I thought I'd tried . but since it clearly works I must have done something wrong the first time. I haven't done any serious Forth programming since about 1988, I must be a bit rusty.

Full stop/period, e.g.:

  2 2 + .
For a full list of words enter 'words'

Period character (with whitespace on either side).

eg:

10 . <return>

10

simply use the dot.

try: 2 3 + .

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.