Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: for us beginners? Help Message-ID: <2115.UUL1.3#5129@willett.pgh.pa.us> Date: 14 Dec 90 03:17:23 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 40 Category 2, Topic 5 Message 173 Thu Dec 13, 1990 D.RUFFER [Dennis] at 21:15 EST Re: J.SANFORD1 Jon, type NAMe at the BB prompt so that your first name will always appear in your messages. Also watch the horrors of the GEnie message formatter. Put a space before every line that you do not want to get messed up. Here is (I believe) what your code was supposed to look like: > \ Inflation Calculator > : R% 10 */ 5 + 10 / ; (S n1 n2 -- n3) ( rounded percent ) > variable amount variable rate > : calc cr - 0 do amount @ rate @ R% amount +! loop > amount @ . ; > : ask cr ." inflation rate ? i.e. 5 rate ! " > cr ." amount ? i.e. 100 amount ! " > cr ." stack -- date2 date1 i.e. 1990 1940 later first " > cr ( the original amount is from earlyer date1 ) > ( the result is the inflation adjusted equivalent for date2 ) I assume that the final ; got lost in the upload, otherwise I don't see a bug (unless you don't like the way the calculation works). If I ignore the calculation, let me suggest a couple of changes: Your R% and ask look ok, so let's concentrate on calc . The following eliminates the variables and does everything on the stack: : calc ( rate amount years - cost) 0 DO 2DUP SWAP R% + LOOP SWAP DROP ; If you really want the dated input and display, define this: : .calc ( r a l f) - calc cr . ; KISS! DaR ----- This message came from GEnie via willett through a semi-automated process. Report problems to: dwp@willett.pgh.pa.us or uunet!willett!dwp