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

From: Henry Lenzi (henry.lenzi at gmail.com)
Date: Wed Jul 30 21:42:07 EDT 2014

Yes, I do, as physician.

This is all internal, nothing is or will be published (but I wouldn't
care/mind releasing the code, when and if I have it). The way to think
of this is: I could be typing stuff out on Word, or I could use the
hospital's buggy and horrible software. But I'll just roll my own,
like I did last year on another job (the FORTH thing - which is
abandoware right now, although it served me well).

This is isn't complex software, you know? This is very stupid stuff.
(But I do realize people make money selling stupid software for
physicians...). What I think I can achieve with Scheme is printing
directly on a .jpeg image (the hospital's layout form for recipes),
using Racket's imaging library. This would be...fun! AND useful. In a
more advanced stage, I can play with optimization and constraints
(e.g., calculating how to properly fit stuff on the page, etc.)

Another thing I want to write is software to monitor our 300
diabetic/hypertensive patients. I had some great ideas looking at
Scheme's graphic capabilities. This would be something
spreadsheet-like, with various (graphical) bells and whistles for
alerts (such as renal function parameters, global cardiovascular risk,
etc.)

We're not a a big hospital complex in the USA. We're in a big public
health hospital complex in southern Brazil. Our hospital doesn't have
the cash for the latest and greatest for medical software. However, I
still prefer my shorthand DSL than anything else I've seen. You show
"HCTZ25 30P 1XD or OMZ20 30P 1P/M" to *any* doctor and I'm willing to
bet they'll IMMEDIATELY grok what it means. That's the power of a
proper DSL.

And, when and if I write this thing, it'll be for me and my colleague
only (that's 3.000 patients), possibly extending to the rest of the
team (that would be 9.000 patients). So, internal, in-house.

Who knows when I'll have this. I'm a busy physician (like all of us).
If I have to start reading advanced mumbo-jumbo or papers with
denotational semantics in order to understand what in the world is the
matter with EVAL in Racket Scheme, I might just give up and go back to
Win32 API (easier, right?) and my proprietary/licensed FORTH that can
ship executables (royalty-free).

(I'm wasting too much time here, when I should be testing the answers
the fine Racketeers have provided me with) ;-)

Cheers,

Henry Lenzi

Cheers,
Henry Lenzi


Cheers,

Henry Lenzi



On Wed, Jul 30, 2014 at 10:02 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> 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.