Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #28274 > unrolled thread
| Started by | hank.lenzi@gmail.com |
|---|---|
| First post | 2014-02-08 18:26 -0800 |
| Last post | 2014-02-15 19:23 -0800 |
| Articles | 20 on this page of 104 — 21 participants |
Back to article view | Back to comp.lang.forth
How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-08 18:26 -0800
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-09 12:18 +0000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-09 20:00 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 15:47 -0800
Re: How to get an address for a string by direct user input without using PAD anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-09 13:02 +0000
Re: How to get an address for a string by direct user input without using PAD anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-09 13:12 +0000
Re: How to get an address for a string by direct user input without using PAD Julian Fondren <julian.fondren@gmail.com> - 2014-02-09 08:48 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-11 16:22 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-11 16:22 -0800
Re: How to get an address for a string by direct user input without using PAD "Elizabeth D. Rather" <erather@forth.com> - 2014-02-09 08:47 -1000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-09 18:13 -0800
Re: How to get an address for a string by direct user input without using PAD Julian Fondren <julian.fondren@gmail.com> - 2014-02-10 02:27 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-14 01:20 -0800
Re: How to get an address for a string by direct user input without using PAD Julian Fondren <julian.fondren@gmail.com> - 2014-02-18 14:14 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-18 20:11 -0800
Re: How to get an address for a string by direct user input without using PAD Julian Fondren <julian.fondren@gmail.com> - 2014-02-19 06:56 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-18 21:17 -0800
Re: How to get an address for a string by direct user input without using PAD Steve <jsgrahamus@yahoo.com> - 2014-02-10 19:29 +0000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-14 01:34 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-11 16:25 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-11 16:59 -0800
Re: How to get an address for a string by direct user input without using PAD "Elizabeth D. Rather" <erather@forth.com> - 2014-02-11 16:58 -1000
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-12 16:07 -0800
Re: How to get an address for a string by direct user input without using PAD Paul Rubin <no.email@nospam.invalid> - 2014-02-12 16:46 -0800
Re: How to get an address for a string by direct user input without using PAD Paul Rubin <no.email@nospam.invalid> - 2014-02-12 16:47 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 15:53 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 15:52 -0800
Re: How to get an address for a string by direct user input without using PAD "Elizabeth D. Rather" <erather@forth.com> - 2014-02-12 14:32 -1000
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-12 17:13 -0800
Re: How to get an address for a string by direct user input without using PAD Paul Rubin <no.email@nospam.invalid> - 2014-02-12 18:56 -0800
Re: How to get an address for a string by direct user input without using PAD anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-13 08:40 +0000
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 17:16 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 16:32 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-14 01:11 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-15 12:15 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-15 17:35 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-14 12:02 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-15 12:57 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-15 18:12 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-15 19:10 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-15 19:34 -0800
Re: How to get an address for a string by direct user input without using PAD "Alex McDonald" <blog@rivadpm.com> - 2014-02-16 09:48 +0000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-16 03:21 -0800
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-17 12:38 +0000
Re: How to get an address for a string by direct user input without using PAD Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-02-17 08:09 -0600
Re: How to get an address for a string by direct user input without using PAD Bernd Paysan <bernd.paysan@gmx.de> - 2014-02-17 19:32 +0100
Re: How to get an address for a string by direct user input without using PAD "Alex McDonald" <blog@rivadpm.com> - 2014-02-17 14:53 +0000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-17 20:48 -0800
Re: How to get an address for a string by direct user input without using PAD "Alex McDonald" <blog@rivadpm.com> - 2014-02-18 16:21 +0000
Re: How to get an address for a string by direct user input without using PAD Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2014-02-16 09:32 +0100
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-16 03:07 -0800
Re: How to get an address for a string by direct user input without using PAD Alexander Skobelev <al.skobelev@gmail.com> - 2014-02-16 10:09 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-16 15:39 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-17 19:54 -0800
Re: How to get an address for a string by direct user input without using PAD "Elizabeth D. Rather" <erather@forth.com> - 2014-02-17 19:51 -1000
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-18 16:40 -0800
Re: How to get an address for a string by direct user input without using PAD humptydumpty <ouatubi@gmail.com> - 2014-02-18 11:44 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-18 15:18 -0800
Re: How to get an address for a string by direct user input without using PAD Julian Fondren <julian.fondren@gmail.com> - 2014-02-18 14:48 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-18 16:00 -0800
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-19 01:01 +0000
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-18 18:11 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-18 18:19 -0800
Re: How to get an address for a string by direct user input without using PAD humptydumpty <ouatubi@gmail.com> - 2014-02-19 11:41 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-19 16:24 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-19 23:08 -0800
Re: How to get an address for a string by direct user input without using PAD Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-02-20 13:11 +0000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-20 21:10 -0800
Re: How to get an address for a string by direct user input without using PAD humptydumpty <ouatubi@gmail.com> - 2014-02-20 22:42 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-21 22:16 -0800
Re: How to get an address for a string by direct user input without using PAD humptydumpty <ouatubi@gmail.com> - 2014-02-20 12:04 -0800
Re: How to get an address for a string by direct user input without using PAD Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-02-19 07:45 +0000
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-19 20:10 +0000
Re: How to get an address for a string by direct user input without using PAD Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-02-19 22:25 +0000
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-20 12:10 +0000
Re: How to get an address for a string by direct user input without using PAD Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-02-20 13:10 +0000
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-20 17:11 +0000
Re: How to get an address for a string by direct user input without using PAD "Elizabeth D. Rather" <erather@forth.com> - 2014-02-15 16:34 -1000
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-15 19:06 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-15 19:22 -0800
Re: How to get an address for a string by direct user input without using PAD "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-13 02:56 -0500
Re: How to get an address for a string by direct user input without using PAD "Elizabeth D. Rather" <erather@forth.com> - 2014-02-12 22:13 -1000
Re: How to get an address for a string by direct user input without using PAD anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-02-13 08:56 +0000
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-13 11:57 +0000
Re: How to get an address for a string by direct user input without using PAD "Rod Pemberton" <dont_use_email@xnohavenotit.cnm> - 2014-02-13 02:56 -0500
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-12 14:56 +0000
Re: How to get an address for a string by direct user input without using PAD mhx@iae.nl - 2014-02-12 11:24 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-12 15:48 -0800
Re: How to get an address for a string by direct user input without using PAD Paul Rubin <no.email@nospam.invalid> - 2014-02-12 16:18 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-12 17:39 -0800
Re: How to get an address for a string by direct user input without using PAD Bernd Paysan <bernd.paysan@gmx.de> - 2014-02-13 01:41 +0100
Re: How to get an address for a string by direct user input without using PAD Hank Lenzi <henry.lenzi@gmail.com> - 2014-02-12 17:25 -0800
Re: How to get an address for a string by direct user input without using PAD Bernd Paysan <bernd.paysan@gmx.de> - 2014-02-14 01:25 +0100
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 17:03 -0800
Re: How to get an address for a string by direct user input without using PAD albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-02-14 02:41 +0000
Re: How to get an address for a string by direct user input without using PAD stephenXXX@mpeforth.com (Stephen Pelc) - 2014-02-13 12:40 +0000
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-11 17:41 -0800
Re: How to get an address for a string by direct user input without using PAD Mark Wills <markrobertwills@yahoo.co.uk> - 2014-02-10 02:32 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-11 17:23 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 15:49 -0800
Re: How to get an address for a string by direct user input without using PAD Julian Fondren <julian.fondren@gmail.com> - 2014-02-12 20:50 -0800
Re: How to get an address for a string by direct user input without using PAD hank.lenzi@gmail.com - 2014-02-13 16:38 -0800
Re: How to get an address for a string by direct user input without using PAD hughaguilar96@yahoo.com - 2014-02-15 19:20 -0800
Re: How to get an address for a string by direct user input without using PAD henry.lenzi@gmail.com - 2014-02-15 19:23 -0800
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
| From | henry.lenzi@gmail.com |
|---|---|
| Date | 2014-02-11 16:59 -0800 |
| Message-ID | <57250061-2462-4e0f-978e-aca53a0dd874@googlegroups.com> |
| In reply to | #28283 |
> > I don't know if the "3" you mentioned is a representative number or a > > stable component of the design -- if you know how many sub-strings > > you're going to want, you can ALLOT or ALLOCATE that many buffers and > > parse the successive pieces of information into those buffers, and then > > continue with your analysis. > > > Cheers, > > Elizabeth > As a matter of fact, yes, the number 3 is not fortuitous. Medical prescriptions always go in triplets, conceptually, like this: Drug specification (name and presenetation, for instance, "Hydrochlorothiazide 25mg") - Quantity and Presentation (such as 30 pills, etc.) - Posology (how and how often you must take/administer the drug). I'm having trouble with memory allocation in Forth (there are *very* few examples around - BTW, I have bought the Forth books from Forth Inc. - and I can't do without them - I *highly* recommend them - an absolute must-have for the Forth novice). When you say "parse", I suppose you mean using WORD or PARSE. The problem I have is allocating a new memory region. Solution have been posted here, and I haven't had the time to test them (it's late at night, after all, at my timezone). As I said, pad kind of restricts me (always the same memory region). How do you mean "allocate those buffers"? Would you be so kind as to expand on that topic a bit? TIA, Hank Lenzi PS: You'll be happy to learn, I just bought a SwiftForth license tonight. ;-) I'm thinking of shipping the prescription software as a standalone executable, eventually. I think my fellow doctor colleagues will appreciate that. They kind of panic when I show them how to load files at the prompt. :-) Anyways, we're on track to serving 6.000 patients' presciptions with my Forth-based DSL and database (it's working as of *now*). I would *never* in my wildest dream could have imagined Forth to be such a productive tool. It's been 3 weeks, and I got *so* much done it's *unreal* - stuff that would have taken me *much* more time in C, C++, Java, etc (I don't really get what Java programmer mean when they say they have frameworks that make them more productive when you have to read 300 pages of documentation just to wrap your head around a framework...What the *hell* is *that* ?!) Anyways, well, what do you know, it is *true* what they say about Forth... Wow! WOW!
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2014-02-11 16:58 -1000 |
| Message-ID | <XK-dnat4w_7wfmfPnZ2dnUVZ_oidnZ2d@supernews.com> |
| In reply to | #28320 |
On 2/11/14 2:59 PM, henry.lenzi@gmail.com wrote: > >> >> I don't know if the "3" you mentioned is a representative number or a >> >> stable component of the design -- if you know how many sub-strings >> >> you're going to want, you can ALLOT or ALLOCATE that many buffers and >> >> parse the successive pieces of information into those buffers, and then >> >> continue with your analysis. >> >> >> Cheers, >> >> Elizabeth >> > > As a matter of fact, yes, the number 3 is not fortuitous. Medical prescriptions always go in triplets, conceptually, like this: > > Drug specification (name and presenetation, for instance, "Hydrochlorothiazide 25mg") - Quantity and Presentation (such as 30 pills, etc.) - Posology (how and how often you must take/administer the drug). > > I'm having trouble with memory allocation in Forth (there are *very* few examples around - BTW, I have bought the Forth books from Forth Inc. - and I can't do without them - I *highly* recommend them - an absolute must-have for the Forth novice). If it's really so consistent, just make them: [n1] BUFFER: SPECIFICATION [n2] BUFFER: QUANTITY [n] BUFFER: POSOLOGY ...where the sizes are the max. length of a string that will go in each buffer. > When you say "parse", I suppose you mean using WORD or PARSE. The problem I have is allocating a new memory region. Solution have been posted here, and I haven't had the time to test them (it's late at night, after all, at my timezone). Sure. But it really depends how your user interface is designed. Since you're talking Windows, I assume you'll have a dialog box for each item which will actually return the string as an addr-len pair on the stack, so you simply say something like: ... GET-SPECIFICATION SPECIFICATION MOVE ... for each one. You'll probably want to initialize each buffer to spaces before asking for the data. What will your user actually be typing? If it's the short form (which might be a selection from a drop-down menu) you can treat words such as CAPT25 as a Forth word, which you can FIND and EXECUTE to put the appropriate string in SPECIFICATION using a phrase like the one above. That limits you to not having spaces in any of these names. If you need spaces, just show the drop-down the way the user would read it and have it return the word to be executed. > As I said, pad kind of restricts me (always the same memory region). Actually, ACCEPT is not so often used in Windows apps, because users expect a dialog box, which delivers results as data. Your SwiftForth manual will give some examples of how to do that. > How do you mean "allocate those buffers"? Would you be so kind as to expand on that topic a bit? Personally, I don't care much for the ALLOCATE/FREE dynamic memory allocation. Since your needs appear to be very specific and well-defined, it's unnecessary overhead and mess. Statically allocated space with BUFFER: or CREATE ... ALLOT is simple and clean. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | henry.lenzi@gmail.com |
|---|---|
| Date | 2014-02-12 16:07 -0800 |
| Message-ID | <2d8cf268-ecdd-44f9-b314-fdb157312578@googlegroups.com> |
| In reply to | #28324 |
Hi -- > If it's really so consistent, just make them: > > > > [n1] BUFFER: SPECIFICATION [n2] BUFFER: QUANTITY [n] BUFFER: POSOLOGY > > > > ...where the sizes are the max. length of a string that will go in each > > buffer. > The thing is, a patient's "continuous use" prescription (as they are called in our health system - diabetes, hypertension depression, etc.) are comprised of more than one drugs. We have patients that take over 20 drugs on a regular basis. To use the above buffers, I would have to pre-determine or pre-define how many drugs on a prescription, right? (or maybe I'm wrong?) This would be doable - but very old-hat (pre-defining stuff). The reason I wanted to fiddle around dynamic memory allocation in regards to strings (due to the PAD memory area, a problem fro which Julian Fondren presented nice solutions) is because you can then store strings on the fly and recycle an input function. > > > When you say "parse", I suppose you mean using WORD or PARSE. The problem I have is allocating a new memory region. Solution have been posted here, and I haven't had the time to test them (it's late at night, after all, at my timezone). > > > > Sure. But it really depends how your user interface is designed. Since > > you're talking Windows, I assume you'll have a dialog box for each item > > which will actually return the string as an addr-len pair on the stack, > > so you simply say something like: Right now, sadly, no I don't have a GUI, because I am still trying to wrap my head around C++ and the Windows API. We have a little Forth prompt. That's ok. Real Soon Now I'll ship some executable, because doctors hate fiddling aroung with configuration files. > > > > ... GET-SPECIFICATION SPECIFICATION MOVE ... > > > > for each one. You'll probably want to initialize each buffer to spaces > > before asking for the data. > > > > What will your user actually be typing? If it's the short form (which > > might be a selection from a drop-down menu) you can treat words such as > > CAPT25 as a Forth word, which you can FIND and EXECUTE to put the > > appropriate string in SPECIFICATION using a phrase like the one above. > Yes, users will type the short form. They're all Forth words (matter of fact, there are over 100 drugs in the file - these are the ones provided for free by the local municipality). I'll have to read up on FIND. I know what you mean with EXECUTE. > That limits you to not having spaces in any of these names. If you need > > spaces, just show the drop-down the way the user would read it and have > > it return the word to be executed. > > > > > As I said, pad kind of restricts me (always the same memory region). > > > > Actually, ACCEPT is not so often used in Windows apps, because users > > expect a dialog box, which delivers results as data. Your SwiftForth > > manual will give some examples of how to do that. > > > > > How do you mean "allocate those buffers"? Would you be so kind as to expand on that topic a bit? > > > > Personally, I don't care much for the ALLOCATE/FREE dynamic memory > > allocation. Since your needs appear to be very specific and > > well-defined, it's unnecessary overhead and mess. Statically allocated > > space with BUFFER: or CREATE ... ALLOT is simple and clean. > > > > Cheers, > > Elizabeth > Thanks. I'll have to do some homework and read up on some more Forth syntax :-) Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2014-02-12 16:46 -0800 |
| Message-ID | <7xiosj3kmh.fsf@ruckus.brouhaha.com> |
| In reply to | #28341 |
henry.lenzi@gmail.com writes: > Right now, sadly, no I don't have a GUI, because I am still trying to > wrap my head around C++ and the Windows API. We have a little Forth > prompt. That's ok. You might consider embedding a web server in the program, then using a browser as the GUI. That would also allow hosting the application on a remote machine, so users could access it from their desktops without having to install anything.
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2014-02-12 16:47 -0800 |
| Message-ID | <7xeh373kjm.fsf@ruckus.brouhaha.com> |
| In reply to | #28342 |
Paul Rubin <no.email@nospam.invalid> writes: > You might consider embedding a web server in the program Added: or just writing it as a CGI, probably the simplest form of web app. I think there is already a Forth web server that supports cgi, if you don't want to use a more conventional server.
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-13 15:53 -0800 |
| Message-ID | <f696e88f-7189-4405-98e4-b62b58d5a540@googlegroups.com> |
| In reply to | #28343 |
> > Added: or just writing it as a CGI, probably the simplest form of web > > app. I think there is already a Forth web server that supports cgi, if > > you don't want to use a more conventional server. Which one? Do you remember? I guess CGI would be OK, as we won't have zillions of hits. - Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-13 15:52 -0800 |
| Message-ID | <bbfe2387-5a3a-467b-a896-25561adf2192@googlegroups.com> |
| In reply to | #28342 |
> > You might consider embedding a web server in the program, then using a > > browser as the GUI. That's a good suggestion. I'll make a note of it. Thanks! - Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2014-02-12 14:32 -1000 |
| Message-ID | <Lu-dnZNye_suj2HPnZ2dnUVZ_q-dnZ2d@supernews.com> |
| In reply to | #28341 |
On 2/12/14 2:07 PM, henry.lenzi@gmail.com wrote: > Hi -- >> If it's really so consistent, just make them: >> >> >> >> [n1] BUFFER: SPECIFICATION [n2] BUFFER: QUANTITY [n] BUFFER: POSOLOGY >> >> >> >> ...where the sizes are the max. length of a string that will go in each >> >> buffer. >> > > The thing is, a patient's "continuous use" prescription (as they are called in our health system - diabetes, hypertension depression, etc.) are comprised of more than one drugs. We have patients that take over 20 drugs on a regular basis. > To use the above buffers, I would have to pre-determine or pre-define how many drugs on a prescription, right? (or maybe I'm wrong?) > This would be doable - but very old-hat (pre-defining stuff). The reason I wanted to fiddle around dynamic memory allocation in regards to strings (due to the PAD memory area, a problem fro which Julian Fondren presented nice solutions) is because you can then store strings on the fly and recycle an input function. Thanks. The more we know the better advice we can give! An alternative (completely different approach) would be to have all the 100+ drugs in a database. A "prescription" could consist of a linked list of the components (probably stored as the record# in the database, not the name). Do you have a patient database where you'd like to store the prescriptions they're taking, or is this just for processing and then the data for this transaction discarded? >>> When you say "parse", I suppose you mean using WORD or PARSE. The problem I have is allocating a new memory region. Solution have been posted here, and I haven't had the time to test them (it's late at night, after all, at my timezone). >> >> >> >> Sure. But it really depends how your user interface is designed. Since >> >> you're talking Windows, I assume you'll have a dialog box for each item >> >> which will actually return the string as an addr-len pair on the stack, >> >> so you simply say something like: > > Right now, sadly, no I don't have a GUI, because I am still trying to wrap my head around C++ and the Windows API. We have a little Forth prompt. That's ok. > > Real Soon Now I'll ship some executable, because doctors hate fiddling aroung with configuration files. Ok. But then you should look into a GUI. You don't need C++ as SwiftForth can issue Windows calls. There's a discussion and some examples in the SwiftForth manual, and a lot more examples in the code shipped with the system. Unfortunately, there is a learning curve associated with the Windows API, though. >> >> ... GET-SPECIFICATION SPECIFICATION MOVE ... >> >> >> >> for each one. You'll probably want to initialize each buffer to spaces >> >> before asking for the data. >> >> >> >> What will your user actually be typing? If it's the short form (which >> >> might be a selection from a drop-down menu) you can treat words such as >> >> CAPT25 as a Forth word, which you can FIND and EXECUTE to put the >> >> appropriate string in SPECIFICATION using a phrase like the one above. >> > > Yes, users will type the short form. They're all Forth words (matter of fact, there are over 100 drugs in the file - these are the ones provided for free by the local municipality). > I'll have to read up on FIND. I know what you mean with EXECUTE. It sounds as though it may be more practical to search for the string typed in the database of prescriptions. There are a couple of good search words in SwiftForth for doing that. Cheers, Elizabeth >> That limits you to not having spaces in any of these names. If you need >> >> spaces, just show the drop-down the way the user would read it and have >> >> it return the word to be executed. >> >> >> >>> As I said, pad kind of restricts me (always the same memory region). >> >> >> >> Actually, ACCEPT is not so often used in Windows apps, because users >> >> expect a dialog box, which delivers results as data. Your SwiftForth >> >> manual will give some examples of how to do that. >> >> >> >>> How do you mean "allocate those buffers"? Would you be so kind as to expand on that topic a bit? >> >> >> >> Personally, I don't care much for the ALLOCATE/FREE dynamic memory >> >> allocation. Since your needs appear to be very specific and >> >> well-defined, it's unnecessary overhead and mess. Statically allocated >> >> space with BUFFER: or CREATE ... ALLOT is simple and clean. >> >> >> >> Cheers, >> >> Elizabeth >> > > Thanks. I'll have to do some homework and read up on some more Forth syntax :-) > Hank Lenzi > -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-12 17:13 -0800 |
| Message-ID | <7817d49a-221c-4e9d-9575-1f593590202e@googlegroups.com> |
| In reply to | #28344 |
> An alternative (completely different approach) would be to have all the
>
> 100+ drugs in a database. A "prescription" could consist of a linked
>
> list of the components (probably stored as the record# in the database,
>
> not the name).
>
Hi --
What I call a "database" is a flat .F file where patients are indexed by a method (it being street code + house number + initials) and then a list of Forth words.
Each patient record is, in fact, a Forth word, like so (not a real patient):
: SAND450-CS \ Carlos Souza
\ 450 Saint Andreas st.
NAME S" Carlos Souza"
C6 \ This will print "Internal use - Continuous - 6 month"
\ and do some formatting to fir the paper.
ENPL10 30P 1P1X \ Enalapril 10mg -------------- 30 pills
\ Take 1 pill/day
HCTZ25 30P 1PM \ Hydrochlorothiazide 25mg ----------- 30 pills
\ Take 1 pill in the morning
L\D \ Date and place
;
I mean, this is so stupid it's probably a big disappointment :-)
All these are Forth words that expand.
As a next step, I would like to have functions for input and to be able to get Forth to write the database by itself, via user input (instead of actually editing them - which is alright anyways, since the DSL is so close to what we practice - I mean we will write a prescription with "Hydrochlorothiazide", but in the patient's record we will use the shorthand "HCTZ".
Oh, linked list, as in data structure? There's an old Forth book I'm reading (Forth Applications, by S.D. Roberts), and he shows how to do linked lists but the book is kind of old (it has EXPECT, and uses screens...) Linked lists in Forth are kind of way over my head right now (me being a doctor...) but think I see what you mean. Do you mean to say to parse the triplets one word at a time, but then link them?
OTOH, I could just stack string addresses and count bytes and just pop them back too, right (hence the importance of allocating the heap, etc., as already discussed).
But, boy, would I like to see some linked list code in Forth! I'll check the SwiftForth documentation in more detail. Maybe there's some sort of utility there that I can simply use?
(...)
> > Real Soon Now I'll ship some executable, because doctors hate fiddling aroung with configuration files.
>
>
>
> Ok. But then you should look into a GUI. You don't need C++ as
>
> SwiftForth can issue Windows calls. There's a discussion and some
>
> examples in the SwiftForth manual, and a lot more examples in the code
>
> shipped with the system. Unfortunately, there is a learning curve
>
> associated with the Windows API, though.
>
>
Yes, I know, I plan on getting around to that, eventually. Right now, it's either what I have or 900 prescriptions for hypertensive patients for me alone, by hand (of course, this isn't in a week, but request for prescription renewals just keep coming...)
Ok, thanks so much!
Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2014-02-12 18:56 -0800 |
| Message-ID | <7xzjlv4t5n.fsf@ruckus.brouhaha.com> |
| In reply to | #28346 |
hank.lenzi@gmail.com writes: > Each patient record is, in fact, a Forth word, like so (not a real patient): > : SAND450-CS \ Carlos Souza This is a bad way to organize the program since it mixes the control plane and data plane together. Better to use some more conventional table structure. E.g. do you currently have a way to search the db for all users of a given drug? How do you generate the unique record name for the patient? ENPL10 30P 1P1X \ Enalapril 10mg -------------- 30 pills It looks like you also have record names for drugs--are they in the same namespace (word list or whatever) as the patient names? Does 30P mean "30 pills"? What if you want 40 pills or 31 pills? Do you need separate words like 40P or 31P? "30 PILLS" makes more sense, I think. Maybe 30P is a word or macro meaning something like that. Python isn't too bad. Most people still use the 2.x series and until you get into esteric features, anything recent in that series is fine.
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2014-02-13 08:40 +0000 |
| Message-ID | <2014Feb13.094025@mips.complang.tuwien.ac.at> |
| In reply to | #28356 |
Paul Rubin <no.email@nospam.invalid> writes:
>hank.lenzi@gmail.com writes:
>> Each patient record is, in fact, a Forth word, like so (not a real patient):
>> : SAND450-CS \ Carlos Souza
>
>This is a bad way to organize the program since it mixes the control
>plane and data plane together.
What's "control plane" and "data plane"?
One of the advantages of Forth is that there is not hard line between
compile-time and run-time. You can define new words at any time.
Using a colon defininition for data is perfectly legitimate, but it
implies a number of restrictions (and that's why it is not used that
often):
- Memory management is restricted: You cannot use ALLOCATE/FREE or
similar to deal with individual words.
- If you define your colon definition to print data, that's all it can
do. You cannot use the same colon definition to, e.g., search
through the data. Of course you can use the source code for the
colon definition with a different definition for the called words,
that, say, store the data somewhere, allowing you to either print or
search the data, but that's more complicated then. Or you can use
CREATE instead of defining a colon definition. But the advantage of
a colon definition is that it is more flexible.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2013: http://www.euroforth.org/ef13/
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-13 17:16 -0800 |
| Message-ID | <ede94ddc-679e-4269-9169-5c2c9f32fad7@googlegroups.com> |
| In reply to | #28368 |
> > Using a colon defininition for data is perfectly legitimate, (snip) > > > - Memory management is restricted: You cannot use ALLOCATE/FREE or > > similar to deal with individual words. Why would I do that? I have *no* idea (honest question). BTW, do you think 6,000 or 7,000 FORTH colon definitions (the ones I'm talking about, used as a patient database) would "blow up memory"? If that's the case, maybe I should write a prescription as a little ".F" file. For instance, the database key "SFA100-MJ" could become "SFA100-MJ.F" Anytime the doc wants to consult the prescrption, it's compiled "on the fly". A thing I'm not quite able to wrap my head around FORTH right now is: if you have a FORTH word, how can you ask for it to produce a string that produces its name? Or is that a wrong question? > > - If you define your colon definition to print data, that's all it can > > do. You cannot use the same colon definition to, e.g., search > > through the data. Of course you can use the source code for the > > colon definition with a different definition for the called words, > > that, say, store the data somewhere, allowing you to either print or > > search the data, but that's more complicated then. Yeah, I was kind of envisioning that something along those lines. Or maybe use some sort of vocabulary-search facility in order to search for things. > Or you can use > > CREATE instead of defining a colon definition. But the advantage of > > a colon definition is that it is more flexible. > So I take this to mean that might be on (some) right path, right? -- Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-13 16:32 -0800 |
| Message-ID | <8f4e808d-0491-4e3a-b87e-f2007203652f@googlegroups.com> |
| In reply to | #28356 |
Em quinta-feira, 13 de fevereiro de 2014 00h56min36s UTC-2, Paul Rubin escreveu: > hank.lenzi@gmail.com writes: > > > Each patient record is, in fact, a Forth word, like so (not a real patient): > > > : SAND450-CS \ Carlos Souza > > > > This is a bad way to organize the program since it mixes the control > > plane and data plane together. Better to use some more conventional > > table structure. But what's wrong with "code is data - data is code?" The way things are, "CAPT25" may mean simply "CAPT25" - or the word can be expanded to a string. This way of doing things allow for new helpful definitions, suchs as: : CAPTOPRIL ." CAPT25 = " CAPT25 ; This is nice. It seems you're suggesting a C "string" approach. > E.g. do you currently have a way to search the db for > > all users of a given drug? > > I would hope I could leverage some sort of vocabulary-searching hack in order to search for words. Antoher option would be to use some regex routine on the FORTH code itself. May I confess something? I understand my approach is not "traditional" in terms of databases. It probably will never scale to terabytes of data (oh, that's alright). However, it seems you're proposing something right of the C-world, a world of strings, not of code. > How do you generate the unique record name for the patient? The record key is the very own FORTH word. This is created methodically: we use shorthand for street names + house number + dash + patient initials. Like so: "Mary Joseph Souza, at Saint Francis of Assisi st, 100" becomes: SFA100-MJS (we really do have a street name that long - but the Mother Theresa of Calcutta is worse). Combinatorics shows this makes sense and is robust, in terms of name clashing. Actually, SFA100-MJS is a FORTH definition, comprised of the type of recipe (whether it is valid for 2 months, or 6 months), the drugs, and other stuff that may be necessary (such as IDC-10 codes, etc.). > > ENPL10 30P 1P1X \ Enalapril 10mg -------------- 30 pills > > > > It looks like you also have record names for drugs--are they in the same > > namespace (word list or whatever) as the patient names? > > They like in a different file. As far as namespace goes, I have not yet used anything like a different vocabulary, or marker overlays. Mainly because I am not proficient in that. > > Does 30P mean "30 pills"? What if you want 40 pills or 31 pills? Do > > you need separate words like 40P or 31P? "30 PILLS" makes more sense, I > > think. Maybe 30P is a word or macro meaning something like that. > Actually, I know what you mean: I could make things that are more orthogonal. However, I want doctors to write the "DEFINITIONS.F" (where I define what "30P" means) by hand. I'm using the KISS principle here. So, to answer your question, you would have to write "31P" as a definition. This is dumb. However, the number of pills os more standardized than you probably suspect (30, 40, 60 - we don't prescribe "31", or "43" - this is by design of the fine people who manufacture pharmaceuticals - we all try to make things easy for patients). But there are more variations than simple multiples. This has to do with the nature fo the drug and the clinical situation (by the way, this is one of the reasons why whenever people who have no familiarity with Medicine screw up software medical software so badly -such as ERM software - you really ought to have a good grasp of your problem domain - or hire someone who does). > > Python isn't too bad. Most people still use the 2.x series and until > > you get into esteric features, anything recent in that series is fine. Like I said, Python would mean shipping a runtime, without any standard way to do it. A commercial FORTH vendor allows be to ship a nice executable (I hope...) Thanks for the feedback, it's much appreciated. -- Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@yahoo.com |
|---|---|
| Date | 2014-02-14 01:11 -0800 |
| Message-ID | <1edd1b91-6871-4f4e-9103-594c3d44c7c9@googlegroups.com> |
| In reply to | #28346 |
On Wednesday, February 12, 2014 6:13:10 PM UTC-7, hank....@gmail.com wrote: > But, boy, would I like to see some linked list code in Forth! I'll check the SwiftForth documentation in more detail. Maybe there's some sort of utility there that I can simply use? See LIST.4TH in the novice package. Also, see the slide-rule program as an example of how to use lists in a non-trivial program. I was inspired by Factor and Common Lisp. They each have a single data structure (sequences for Factor and lists for Lisp) that pretty much everything is done in. So I made linked lists the basis for most of the novice package. You can use the :NAME-based definers (1ARRAY etc.) without knowing how :NAME itself works --- hold off on learning :NAME until you have a better grip on the basics. You are not ready for meta-compiling yet. Also, slow down. You are too fired up with enthusiasm --- you are listening to every piece of advice that you get, most of which is contradictory. I'm glad that you are excited to learn Forth, and I'm very glad that you are learning Forth by writing an application program (rather than by writing a Forth compiler) --- but you aren't going to learn this stuff in one day. You definitely should not have spent money on SwiftForth, or on anything else, before you knew more about the subject. Your program seems pretty easy --- that is good, as it is best that your first effort should succeed. My novice package has everything that you need --- learn how to use FIELD and the lists first, as that is the basis for quite a lot of programming. BTW: What language is that at the top of your posts? It looks like Romanian to me, although I don't really know much about languages. P.S. Another doctor who was into Forth, was Ray Duncan --- he wrote UR/Forth for Laboratory Microsystems --- I used UR/Forth when I was a professional Forth programmer, but UR/Forth is obsolete now.
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-15 12:15 -0800 |
| Message-ID | <cb1ae951-fb9d-4601-b1a2-ed1a90e52d40@googlegroups.com> |
| In reply to | #28416 |
On Friday, February 14, 2014 7:11:41 AM UTC-2, hughag...@yahoo.com wrote:
> On Wednesday, February 12, 2014 6:13:10 PM UTC-7, hank....@gmail.com wrote:
>
> > But, boy, would I like to see some linked list code in Forth! I'll check the SwiftForth documentation in more detail. Maybe there's some sort of utility there that I can simply use?
>
>
>
> See LIST.4TH in the novice package. Also, see the slide-rule program as an example of how to use lists in a non-trivial program.
(snip)
I am looking at the package.
I'm having a bit of trouble with the examples (not concrete enough for me, right now).
list
w field .line
constant seq
: init-seq ( str node -- node )
init-list >r
hstr r@ .line !
r> ;
: new-seq ( str -- node )
seq alloc
init-seq ;
What's "node"? A number?
How do I traverse this list.
>
>
> BTW: What language is that at the top of your posts? It looks like Romanian to me, although I don't really know much about languages.
>
You're in the right ball park, since you were able to tell it's a Romance language (like French, Italian, Spanish) - it's Portuguese (hence, the very long patient names).
>
>
> P.S. Another doctor who was into Forth, was Ray Duncan --- he wrote UR/Forth for Laboratory Microsystems --- I used UR/Forth when I was a professional Forth programmer, but UR/Forth is obsolete now.
Nice to know. Ocasionally, doctors are known to dabble outside their field.
Thanks for taking the time to give feedback!
-- Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@yahoo.com |
|---|---|
| Date | 2014-02-15 17:35 -0800 |
| Message-ID | <49dd318a-6f5b-4832-8e87-1b9e576a6b9f@googlegroups.com> |
| In reply to | #28461 |
On Saturday, February 15, 2014 1:15:18 PM UTC-7, hank....@gmail.com wrote:
> I am looking at the package.
> I'm having a bit of trouble with the examples (not concrete enough for me, right now).
>
> list
> w field .line
> constant seq
This is a crude form of OOP. FIELD defines fields in a record (a "struct" to use C terminology). The field .LINE will, when executed, take a node address as a parameter and return the address of a field in the node (it just adds a constant to the node address).
The SEQ data-type inherits everything from the LIST data-type. LIST is the size of an instance of the LIST data-type. All of the fields of SEQ (there is only one, which is .LINE) are appended to the end of all of the fields of LIST.
SEQ is the size of an instance of the SEQ data-type. You could have a child data-type that inherits all of the fields of SEQ (I do that in some example code in LIST.4TH).
> : init-seq ( str node -- node )
> init-list >r
> hstr r@ .line !
> r> ;
This is the constructor for the SEQ data-type. It first calls INIT-LIST which is the constructor for the LIST data type, this takes care of initializing all of the fields in the LIST part of SEQ. Then it initializes all of the new fields that were appended (there is only one, which is .LINE).
> : new-seq ( str -- node )
> seq alloc
> init-seq ;
This creates a new node of the SEQ data type, and it initializes it (by calling the constructor).
If you understand the code I've discussed in this post, then you should grasp the entire concept of OOP as I've implemented it --- this is a fundamental part of the novice package. AFAIK, nobody on comp.lang.forth has ever figured this stuff out --- so you would be the first --- it is not difficult, but it will take some intelligence on your part (intelligence is sorely lacking on comp.lang.forth, which is why nobody else has succeeded yet).
If you want a "concrete example" of LIST.4TH in action, study the slide-rule program.
> What's "node"? A number?
The term "node" refers to a pointer to a record --- typically the record is stored in some kind of data-structure such as a linked-list or a binary-tree.
> How do I traverse this list.
EACH is used to traverse an entire list. Also, FIND-NODE traverses a list and stops when it finds a match.
When I said that I have a "crude form of OOP," I meant that I have inheritance working --- I don't have polymorphism, which I don't consider to be important. I also don't have a VMT --- if you want a virtual method, just have a field containing an xt --- the only advantage of a VMT is that all of these virtual-method fields don't have to be initialized by the constructor, which makes the constructor slightly faster and less complicated than with my way, but I don't consider that to be important (my way is more like Niklaus Wirth's Oberon language than C++).
Do you know C++ or any other OOP language?
> > BTW: What language is that at the top of your posts? It looks like Romanian to me, although I don't really know much about languages.
>
> You're in the right ball park, since you were able to tell it's a Romance language (like French, Italian, Spanish) - it's Portuguese (hence, the very long patient names).
Oh, I should have guessed Portuguese rather than Romanian, as your patient's name (Carlos Souza) is Hispanic. Are you in Portugal or Brazil? Have you read the books "Blindness" and the sequel "Seeing" by the Portuguese author Jose Saramago? "Blindness" is about an epidemic of blindness that strikes Portugal --- this was made into a movie staring Julianne Moore --- as a doctor, you might be interested in "Blindness" ("Seeing" was about politics and had little to do with "Blindness" except that some characters were carried over).
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@yahoo.com |
|---|---|
| Date | 2014-02-14 12:02 -0800 |
| Message-ID | <191a6edc-9baf-461e-83cb-3d904b794d90@googlegroups.com> |
| In reply to | #28346 |
On Wednesday, February 12, 2014 6:13:10 PM UTC-7, hank....@gmail.com wrote: > Each patient record is, in fact, a Forth word, like so (not a real patient): > > : SAND450-CS \ Carlos Souza > \ 450 Saint Andreas st. > NAME S" Carlos Souza" > C6 \ This will print "Internal use - Continuous - 6 month" > \ and do some formatting to fir the paper. > ENPL10 30P 1P1X \ Enalapril 10mg -------------- 30 pills > \ Take 1 pill/day > HCTZ25 30P 1PM \ Hydrochlorothiazide 25mg ----------- 30 pills > \ Take 1 pill in the morning > L\D \ Date and place > ; There are several valid techniques to do this. As a learning exercise, I recommend that you write your program several times, using a different technique each time. Here is the simplest technique, so start with this one: Your data file will be in comma-delimited format with each line being a record. For example, a line could look like this: "Souza, Carlos", 450 Saint Andreas st., C6, "ENPL10, 30P, 1P1X", "HCTZ25, 30P, 1PM" Look in LIST.4TH and find a function that loads a data file into a SEQ linked list with each node containing a string which corresponds to each line in the file. Also, in LIST.4TH you will find code that splits a comma-delimited string into a SEQ with each node containing a string which corresponds to each comma-delimited string in the line. For example, the above line would become a linked-list with these strings in each node: Souza, Carlos 450 Saint Andreas st. C6 ENPL10, 30P, 1P1X HCTZ25, 30P, 1PM You can further split the comma-delimited strings (such as "Souza, Carlos" into linked lists) --- so you end up with a hierarchy of linked-lists. There is code in LIST.4TH that allows you to search a linked list and find nodes containing certain keys. The above is a super-simple solution! This is the work of an hour or two, and you have essentially everything that you need. Searching linked lists is somewhat slow because it is a linear search. If your database has hundreds of records this might be a problem (actually, with modern computers being so fast, it won't become a problem until you get up to thousands of records). The solution is in ASSOCIATION.4TH which has code for an LLRB tree. Build a tree in which each node contains a key string (such as "Souza") and a pointer to the record in the upper-level linked-list. The self-balancing tree provides significantly faster searches. You can have several of these trees, each using a different key --- that way you can look up records by patient name, by what drug is being administered, by what city the patient lives in, etc.. I was recently reading a book about the use of mathematics in criminal investigations. This relates to health-care. If you have a database of every patient in your country, you can write code that searches the database for patterns. These would be patterns such as a significant number of patients using a particular drug, a significant number of patients in a particular city, etc.. With some statistical analysis to determine what "a significant number" is, you can detect patterns that indicate the emergence of an epidemic and/or a bio-weapon attack. By the time that these patterns become obvious enough that doctors would spot them by eye, the epidemic would be out of control. If your computer can spot the problem early though, then the epidemic can be brought under control before too many people are affected. To do this, you would also want to have data on the population such as who is missing work because of illness, what children are missing school because of illness, what OTC drugs are being sold and where, and so forth. Compare this to your database of patients to determine of a significant number of them are using a particular drug. There is quite a lot that can be done with computers these days!
[toc] | [prev] | [next] | [standalone]
| From | hank.lenzi@gmail.com |
|---|---|
| Date | 2014-02-15 12:57 -0800 |
| Message-ID | <8b326002-ad4d-41a6-8ec0-e1d430ccff1a@googlegroups.com> |
| In reply to | #28435 |
On Friday, February 14, 2014 6:02:38 PM UTC-2, hughag...@yahoo.com wrote: > > There are several valid techniques to do this. As a learning exercise, I recommend that you write your program several times, using a different technique each time. > > > > Here is the simplest technique, so start with this one: > > > > Your data file will be in comma-delimited format with each line being a record. For example, a line could look like this: > > > > "Souza, Carlos", 450 Saint Andreas st., C6, "ENPL10, 30P, 1P1X", "HCTZ25, 30P, 1PM" > Hi Hugh -- First, let me say the novice package looks tremendously interesting. However, I feel I'm nod advanced enough to work through your documentation. May I suggest you write a very simple tutorial, with examples? On what regards your suggestions, I don't think I'm making my self clear. Let me try again: I already have what I call "a database with a DSL for free". They are the little recipes we write in shorthand. What I would like to do next is to be able to create functions that will write back the Forth code to file, in that format I specified. I should add: I would like to have words for input that: - take in a line in "prescription shorthand" (they are triplets but not necessarily, e.g, HCTZ25 30P 1PM") - I don't want to declare, say, 20 variables beforehand in the code, expecting the case a patient will have 20 drugs to renew (might happen...for a few patients...). If I use BUFFER:, for instance, I have to declare 20 possible buffers, instead of allocating memory space at run-time. - Because of this, I wanted heap allocation for strings. I can ask for shorthand form (CAPT25), then allocate heap space and store it there. - The use of FORTH words allow for two forms: "CAPT25" and the expansion into a string, for final printing "Captopril 25mg" (along with other minor details). - The use of a shorthand is nice because (hopefully) I'll do some spellchecking (no idea on how - however, the shorthand form being a bonafide FORTH worth, hpefully I can figure out a way for the FORTH engine to bork at a wrong spelling). - A data structure, such you linked lists, would be nice because I could keep track of the strings that were "converted" to heap mempory (via Julian's SAVE-MEM) That format works, because: 1) Patient record is simply the name of a colon definition; 2) everything else in the prescription is a FORTH word too. Writing a comma-delimited file would not add functionality. At least, I don't see why it would. Also, writing in those extra quotes would be something that eventually gets in the way. What I need is something that is *extremely* compact, down to the very minimal. We need to write a lot of stuff down, all the time (that's why doctors' handwriting is notoriously bad, BTW), whether it be prescriptions, or filing epidemiological reports, legal reports, etc. Right now, what I have boils down to minimal writing. I'm just trying to figure out ways to accept a valid FORTH statement, such as "CAPT25 30P 1XD" and: 1) allocate heap for it (done - thanks, Julian); 2) retrieve it for later (possible, but must keep track of stuff - for instance, a hash table that has CAPT25 as the keyword, and then keeps the other data (which would be in the form "c-addr u" for every item). It's been suggested that I use an execution token of, say, CAPT25 in order to generate the hash key. I think I understand that...I suppose the person meant using vectored execution...But then what about the "c-addr u", fruits of dynamical heap allocation (remember, that problem began when I found out PAD kept allocating the same addresses)? In the case of your list package, for instance, the could the structure support something like (the representation bellow being NODE1->NODE2->NODE3 etc)? (Suppose the prescription lines: "CAPT25 30P 1PD", next line "SIMVA20 30P 1PN" - this last one Simvastatin 20mg 30 pills 1 pill at night, BTW.) CAPT25->c-addr1->u1->c-addr2->u2->c-addr3->u3---->SIMVA20->etc... I really couldn't figure out list traversal in your documentation. Also, it seems I have to know the node count, in order to move a new item to the linked list? Is that right? I'm not sure a linked list would be the best data structure... TIA, -- Hank Lenzi
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@yahoo.com |
|---|---|
| Date | 2014-02-15 18:12 -0800 |
| Message-ID | <bf67eb2e-92cd-4d31-9ab0-8b49fa854870@googlegroups.com> |
| In reply to | #28462 |
On Saturday, February 15, 2014 1:57:22 PM UTC-7, hank....@gmail.com wrote: > On Friday, February 14, 2014 6:02:38 PM UTC-2, hughag...@yahoo.com wrote: > > Here is the simplest technique, so start with this one: > > > Your data file will be in comma-delimited format with each line being a record. For example, a line could look like this: > > > "Souza, Carlos", 450 Saint Andreas st., C6, "ENPL10, 30P, 1P1X", "HCTZ25, 30P, 1PM" > On what regards your suggestions, I don't think I'm making my self clear. Let me try again: > > I already have what I call "a database with a DSL for free". They are the little recipes we write in shorthand. > What I would like to do next is to be able to create functions that will write back the Forth code to file, in that format I specified. I should add: I would like to have words for input that: > - take in a line in "prescription shorthand" (they are triplets but not necessarily, e.g, HCTZ25 30P 1PM") > - I don't want to declare, say, 20 variables beforehand in the code, expecting the case a patient will have 20 drugs to renew (might happen...for a few patients...). If I use BUFFER:, for instance, I have to declare 20 possible buffers, instead of allocating memory space at run-time. > - Because of this, I wanted heap allocation for strings. I can ask for shorthand form (CAPT25), then allocate heap space and store it there. > - The use of FORTH words allow for two forms: "CAPT25" and the expansion into a string, for final printing "Captopril 25mg" (along with other minor details). > - The use of a shorthand is nice because (hopefully) I'll do some spellchecking (no idea on how - however, the shorthand form being a bonafide FORTH worth, hpefully I can figure out a way for the FORTH engine to bork at a wrong spelling). > - A data structure, such you linked lists, would be nice because I could keep track of the strings that were "converted" to heap mempory (via Julian's SAVE-MEM) > > That format works, because: 1) Patient record is simply the name of a colon definition; 2) everything else in the prescription is a FORTH word too. > > Writing a comma-delimited file would not add functionality. At least, I don't see why it would. Also, writing in those extra quotes would be something that eventually gets in the way. What I need is something that is *extremely* compact, down to the very minimal. > > We need to write a lot of stuff down, all the time (that's why doctors' handwriting is notoriously bad, BTW), whether it be prescriptions, or filing epidemiological reports, legal reports, etc. Right now, what I have boils down to minimal writing. > > I'm just trying to figure out ways to accept a valid FORTH statement, such as "CAPT25 30P 1XD" and: 1) allocate heap for it (done - thanks, Julian); 2) retrieve it for later (possible, but must keep track of stuff - for instance, a hash table that has CAPT25 as the keyword, and then keeps the other data (which would be in the form "c-addr u" for every item). > > It's been suggested that I use an execution token of, say, CAPT25 in order to generate the hash key. I think I understand that...I suppose the person meant using vectored execution...But then what about the "c-addr u", fruits of dynamical heap allocation (remember, that problem began when I found out PAD kept allocating the same addresses)? > > In the case of your list package, for instance, the could the structure support something like (the representation bellow being NODE1->NODE2->NODE3 etc)? (Suppose the prescription lines: "CAPT25 30P 1PD", next line "SIMVA20 30P 1PN" - this last one Simvastatin 20mg 30 pills 1 pill at night, BTW.) > > CAPT25->c-addr1->u1->c-addr2->u2->c-addr3->u3---->SIMVA20->etc... I'm not at all clear on what you want, but I'll take a shot at offering some advice. My understanding is that you want to have a file containing all of your patients' info. This is why I recommended a comma-delimited text file. I said that each record could look like this: "Souza, Carlos", 450 Saint Andreas st., C6, "ENPL10, 30P, 1P1X", "HCTZ25, 30P, 1PM" If you don't like the quotations, then use a single-level format like this: Souza, Carlos, 450 Saint Andreas st., C6, ENPL10, 30P, 1P1X, HCTZ25, 30P, 1PM I know that Forth is the original DSL, but I don't think this is a good approach for what you are doing. You want to convert an abbreviation string such as "SIMVA20" into a readable string such as "Simvastatin 20mg." Look in ASSOCIATION.4TH for code to do this. An association is a data structure that associates one string with another. Each node would contain two fields: the key field (SIMVA20) and the associated field (Simvastatin 20mg.). The Forth compiler's dictionary has been used as an association data-structure (I did this in my 65c02 cross-compiler and source-level debugger), but that is a crude and clunky technique that went out of style a quarter of a century ago --- you are better off to use my ASSOCIATION.4TH that was designed specifically to be used as an association data-structure. > I really couldn't figure out list traversal in your documentation. Also, it seems I have to know the node count, in order to move a new item to the linked list? Is that right? Use EACH for list traversal --- there are abundant examples of this in there. Note that in my comments I used the term "toucher" to refer to the function that touches each node in the list --- this is an awkward term --- this is roughly comparable to a "quotation" or "closure," but is not exactly the same, which is why I invented my own term. It is possible to append one list onto another list (also, one or the other list may be a single node). Internally, my code does have to find the last node of the first list before it can append the second list, but you don't have to know the node count yourself as this is figured out internally. All of this stuff is really simple and easy --- don't be intimidated, as it is not advanced at all. :-) Nobody on comp.lang.forth has ever figured any of this out, so I would be very pleased if somebody actually did figure it out --- the fact that you are a doctor indicates that you must be reasonably intelligent, so I have high hopes for you --- don't give up too easily! > I'm not sure a linked list would be the best data structure... I have written large programs using only linked lists (such as the slide-rule program). Also, the Lispers seem to get by pretty well using only lists. Lists are a very versatile data-structure --- if you are going to use the novice package, you have to learn to love lists! Also, I have ASSOCIATION.4TH which is more useful in cases where you have to look up nodes by a key --- looking up nodes by a key is possible with linked lists, but it is slow because it is a linear search. Also, ASSOCIATION.4TH allows you to traverse subsets of your data-structure rather than the entire thing (for example, if your key is the patient's last name, you could traverse only those names that start with an 'S').
[toc] | [prev] | [next] | [standalone]
| From | henry.lenzi@gmail.com |
|---|---|
| Date | 2014-02-15 19:10 -0800 |
| Message-ID | <a8036605-a718-4613-b7e7-5467fdf6a8f7@googlegroups.com> |
| In reply to | #28467 |
> > You want to convert an abbreviation string such as "SIMVA20" into a readable string such as "Simvastatin 20mg." Look in ASSOCIATION.4TH for code to do this. An association is a data structure that associates one string with another. Each node would contain two fields: the key field (SIMVA20) and the associated field (Simvastatin 20mg.). > Hi Hugh -- I did look into your code - it's kind of hard to grok, from where I'm standing. I did find a nice list implementation, from (Peter?) Salvi: https://www.iit.bme.hu/~salvi/archive/snippets/linked-list.html Are you aware of it? It looks pretty nice. -- Hank Lenzi
[toc] | [prev] | [next] | [standalone]
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
Back to top | Article view | comp.lang.forth
csiph-web