[racket] Use of map and eval to evaluate symbol in namespace

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Jul 30 21:02:47 EDT 2014

Hi Henry: do you work in the heath system? If you have any pointers
I'd be interested to read about your work and how you use things like
Forth (or maybe someday, Racket! :) in that work.

Best,
Robby

On Wed, Jul 30, 2014 at 7:49 PM, Henry Lenzi <henry.lenzi at gmail.com> wrote:
> Hi Daniel --
>
> Do you mean the Forth files?
> I don't belienve they would make much sense to you, but it would go
> something like this (as you can see, that is a FORTH definition):
>
> : NAME S"John Doe"
>    CU4
>    HCTZ25 30P 1CPM
>    OMZ20 30P 1CPM INSTOMZ
>    SIMVA20 30P 1CPN
>    L\D ;
>
>  Expands to (NOTE: Some things are germane to our public health
> system, such as renewing "continuous use" gratis medications, recipe
> valid for 4 months):
>
> John Doe
>
> Continuous use - 4 months
>
> Hydrochlorothiazide 25mg ---------------- 30 pills
>
>     Take 1 pill P.O. in the morning.
>
> Omeprazol 20mg ----------------------------- 30 pills
>
>    Take 1 pill P.O. in the morning, 1/2 hour
>    before breakfast.
>
> Simvastatin 20mg ---------------------------- 30 pills
>
>     Take 1 pill P.O. at night.
>
>                     City, xx/xx/xxxx
>
>
> So what´s happening here is that inside the FORTH definition,
> everything delimited by ":" and ";" is a FORTH word, as they say, that
> is to say, valid FORTH code.
> The very cheap trick here is simply writing a file with plain text
> (but called .fth, .f or other FORTH designations for filetypes)
> begining with a ":", ending with a ";", and everything in between,
> which are the FORTH words.
> The FORTH reader than opens this file. As soon as it hits the ":", it
> recognizes it's FORTH code. It's all amazingly stupid. However, what
> you get is: a DSL hassle-free (no parsing/lexing), a flat-file
> database for free (the name of the files), an interpreter (comes with
> the territory). And code is data, data is code, in a very, very
> concrete way.
>
>
> Cheers,
>
> Henry Lenzi
>
>
>
>
>
>
> On Wed, Jul 30, 2014 at 6:29 PM, Daniel Prager
> <daniel.a.prager at gmail.com> wrote:
>> Hi Henry
>>
>> Racket is very suitable for writing DSLs, or even whole Ls (more advanced!).
>> As you'd expect, the idioms for DSL construction in straight Racket are
>> different from those in Forth and will take a bit of familiarization and
>> adjustment.
>>
>> Would you be willing to share a more fully-fledged example of a shorthand
>> medical recipe (input) and reconstructed recipe (output) so that the Racket
>> Community can better understand what sounds like a very worthwhile project?
>>
>>
>> Dan
>>
>>
>> On Tue, Jul 29, 2014 at 6:21 AM, Henry Lenzi <henry.lenzi at gmail.com> wrote:
>>
>>> Of course, the ultimate purpose would be to re-evaluate the imported
>>> symbol and reconstruct a medical recipe. The purpose of these
>>> baby-steps exercises is porting a medical recipe program I've written
>>> originally in Forth that allowed me to service 5.000 patients creating
>>> a little database of shorthand recipes that then expand into real
>>> medical recipes. I got hundreds of patients on renewable recipes for,
>>> say, hypertension. Hand writing is no fun. Typing them in Word is no
>>> fun. The hospital has is its own software, but it's is a load of
>>> baloney, extremely buggy, if you ask me, so I'm rolling my own again,
>>> except I want to print directly on the model paper our service uses,
>>> so I want graphics like Racket Scheme has (very good capabilities, as
>>> far as my needs are concerned).
>>>
>>> With Forth, it's very easy to design DSLs, because there's no syntax
>>> and you get a lot of advanced features for free. For instance, there's
>>> no need to write a parser for my little language. However, since Forth
>>> implementations fall short of dealing with images, graphics (unless
>>> you take the royal road to pain and learn to program for the Win32 API
>>> and how it works for a particular Forth vendor), I'm looking at Racket
>>> Scheme.
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.