Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • \$\begingroup\$ I don't know Whitespace either, but reading from the documentation, it seems input values are actually stored at the heap location pointed to by the top of the stack, not on the stack itself. \$\endgroup\$ Commented Jun 11, 2019 at 21:49
  • \$\begingroup\$ @ArBo Possible. I just know that if I did "read, print" I would get my input back. But if I did "read, push 10, print, print" I would get 10 and an error. So I went "heck with it" and just did what I knew I could. \$\endgroup\$ Commented Jun 11, 2019 at 22:45
  • 1
    \$\begingroup\$ FYI: input in Whitespace is indeed pushed to the heap, which acts as a dictionary/map. So let's say you do: push 10, read STDIN. The stack will be empty, and the heap will contain [{10: input}]. To make a cat program that reads and outputs immediately in Whitespace, you usually want to do something like: Push 0; duplicate 0; read STDIN; retrieve (this will pop the 0 we duplicated, and push the value from heap-address 0 to stack); pop and output to STDOUT. PS: Here a useful online debugger I always use. \$\endgroup\$ Commented Jun 27, 2019 at 14:19
  • \$\begingroup\$ @KevinCruijssen Useful! \$\endgroup\$ Commented Jun 27, 2019 at 14:24