Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.lang.forth Subject: Re: How to get an address for a string by direct user input without using PAD Date: Thu, 13 Feb 2014 02:56:56 -0500 Organization: Aioe.org NNTP Server Lines: 29 Message-ID: References: <153253e8-4cb9-4438-8357-9dd8872388a4@googlegroups.com> <0KidnSWD8a-kUGrPnZ2dnUVZ_rGdnZ2d@supernews.com> <57250061-2462-4e0f-978e-aca53a0dd874@googlegroups.com> <2d8cf268-ecdd-44f9-b314-fdb157312578@googlegroups.com> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:28362 On Wed, 12 Feb 2014 19:07:15 -0500, wrote: > 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. I'm not sure of a Forth solution, perhaps a description of a C style solution will inspire you or someone. You'll need to read the C info to understand why I mention what I do about Forth afterwards. A C solution would likely use integers here. I.e., integers to represent each drug. You'd need a method to convert strings for drug names to integers, and also from integers to strings. In C, that would be done by lookup tables, i.e., an indexed arrays of strings. You'd loop and compare strings to find the index, or you'd index to retrieve a string. You could also use a hash function generating integers from strings. In Forth, you already have mechanism that converts strings to integers. You simply define a Forth word. It's XT is an integer. Each word is placed in a "database" - the Forth dictionary - which is usually a linked-list of Forth words. FIND and ' (tick) or compling a word into a definition are ways to use the XT. Rod Pemberton