Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Advanced Beginners Message-ID: <535.UUL1.3#5129@willett.UUCP> Date: 23 Feb 90 23:19:12 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 23 Date: 02-22-90 (08:50) Number: 2941 (Echo) To: IAN GREEN Refer#: 2939 From: STEVE PALINCSAR Read: NO Subj: FORTH Status: PUBLIC MESSAGE Ian, the words are ! (store) and @ (fetch). Before discussing their usage, I must explain that the default behavior of a forth variable is to place its address on the stack. Now let's define a variable: VARIABLE SNIP When we invoke SNIP what we do is place its address on the stack. To store 5 at the memory location we've established with SNIP we simply put 5 on the stack, put SNIP's address on the stack by invoking its name, and then use the ! operator: 5 SNIP ! The stack diagram for ! is ( n addr -- ) which indicates that it wants an integer value with an address on top of it as its stack arguments; after execution, no arguments are returned. SNIP @ will put the value stored at SNIP on the stack. @'s stack diagram is ( addr -- n ). ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'