On the Ease of Stacks
When you program a Personal Computer, then you are, as it were, installing a little extra machinery into it. And that is exactly what it is made for. The underlaying simplicity of the machine, and its flexibility, its capacity to store fresh impulses in its mechanical memory, its RAM {’random access memory’, meaning that you can access any bit of it you’d like}, makes it an ideal framework for encouraging the art of thinking, stimulating to greater clarity, more structure. It can also be useful in practical tasks but it is important to realize that many human practical tasks have a complexity that goes beyond what we should try and put computers to. Driving cars is one example. Unless the driving happens in a closed tunnel with only one file and no other entities but the bus in the tunnel,--a totally well-defined context--then the complexities involved are so as to make it incorrect to apply the computer idea there. People can try it, of course; but it should be pretty obvious to one who applies both rationality and intuition, rational intellect and intuitive intellect, over some time, that computers shouldn’t meddle in many human affairs, and they should be kept pretty much out of all decision-making where the conditions are fuzzy and floating and context-dependent.
So the personal computer is SIMPLE. That is part of its definition. If it isn’t simple, how it can it be personal? So that is the PC idea as we see it in G15 works.
Part of the simplicity of thinking about how to program is that the PC does ONE THING AT A TIME. It can do some things like adding numbers or putting a pixel to the screen very fast compared to how we’d manually do it; and by shifting quickly between a number of tasks like that, back and forth, it can give a sense of doing things in parallel; but the point of the Personal Computer is that it has a possibility of being programmed to run clear-cut succinct, beautiful programs, also called ‘algorithms’. These are step by step instructions; and even if there are some languages for PCs that have been made and that conceal this simple truth in pompeous ideas of ‘objects’ and ‘activities’ and such, or worse, with mind-like or human-like notions blended into the ideas, so that it is spoken of ‘agents’ or ‘learning’ (and THEY speak of it without quotes!), we must stick to this one-thing-at-a-time idea if we want to be faithful to the pure concept of the computer. It has a core, a heart in a sense, which is called CPU, Central Processing Unit. In the case of the G15 approach, this CPU can be run as it were on top of a broader, perhaps less elegantly defined computer, or as a CPU somehow wired together on its own premises, the G15 CPU. We’ll look into how to program the G15 CPU for some advanced PMN programs elsewhere.
But for now, thing of this one-thing-at-time idea. This means that when we have a task that is composed of subtasks, and each has to have its own little numbers to arrange things, and we have a single series of numbers presented to them somehow, then we are led naturally to the beautiful notion of a number stack, a digital stack, The Stack.
So, let us imagine that in our house, there is one big desk. You are the boss. You call in somebody to do one task, and allow this person to use the desk while you watch over it. Then you order somebody else to come in ad use the same desk. You want each to clean up properly; you assume that they will, that they are responsible. But in some cases, the sequences of the tasks matter, for you want one person to build on the results of what another person did. And so, it is an advantage that there is one common desk. For one person’s completed subtask will then leave the exact desired result that the next person employed to do the next subtask can pick up.
So, for instance, if you go into a PMN terminal, you can type in something like this to add two numbers, then multiply two different numbers, then add all this again, and print it out. Keep the numbers within the psychologically meaningful size of not exceeding something like 9 digits. That is to say, keep them within about 999,999,999,999. You can go up to plus minus 2 billion if you like, and still be within the definition of a solid good rugged socalled “32-bit” computer. {Longer numbers can be handled by special routines, though.}
So here is what you can type in, to start with, if you are learning about stacks. The overview over the inbuilt PDs, the PreDefined words in PMN is easily accessible within the G15 platform. AD is ADdition, SU is SUbstract, MM is multiply, MO is MOdulus (remainder of a whole number division), DI is whole number division. There are ways of treating numbers that can be understood to be fractional numbers, but again, a pure conceptual Personal Computer mustn’t be cluttered with things that aren’t clean-cut digital in its core design. Still, we can do trigonometry and so on, to a fair and practical extent, as we see elsewhere. Anyhow! Try this--with or without the extra blank lines; it is a common feature between such typed-in programs, and programs run from cards, that you can have blank lines in between the statements. When you start a program from a card, it will keep compiling cards until it finds a card that starts with its socalled ‘nilchar’, which is the type of thing you see with cards that you haven’t put anything on yet; you can copy such ‘nilcard’ from anywhere to anywhere by the CTR-commands that work within the CAR editor:
23 230 ad
55 5000 mm
ad nn
How big is the stack? Big enough! But if you want thousands of things stored in RAM, use other ways--an array, or such. We look into that elsewhere in this tutorial. Another question: do you have to use the stack to communicate numbers or other things between functions? No, you can use such as variables as well. Named things. Also something we look into elsewhere.
Now, if you want to check that a function cleans up neatly after it, it is usualy enough that you start it up in the High-Powered PMN Terminal and type either ‘nn’ directly, or more normally this:
f nn
The single-letter function ‘f’ means ‘forge a copy’, make the top number on the stack be there twice. So when ‘nn’ picks it up and shows it on the screen, it will still be there. The High-Powered PMN Terminal puts 123456 into the stack before it loads all its extra stuff. And so it is a convenient way to check that all is well with the PC that you type in the above, after trying out a new function on top of all that. Let us say here that all the functions you make yourself by means of the equal-sign = and completed by a dot (.) must have three letters or more. You can make more two-letter PD words at an advanced stage in your G15 PMN learning. If the word already has been defined, the FIRST definition applies. This is one of the things you must check. Try to type in the word you wish to define e.g. in the High-Powered terminal, and see if you get the typical question-marked message; if so, go ahead and define the word!










