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

2014-08-11 Thread Pierpaolo Bernardi
On Mon, Aug 11, 2014 at 8:07 AM, Matthew Flatt wrote: > +1 > > In the grand scheme of things, using `eval` to solve a problem (because > you want to get something done now) is nowhere near as bad as, say, but, to come back to the original question, in order to not confuse further the OP: in this

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

2014-08-10 Thread Matthew Flatt
+1 In the grand scheme of things, using `eval` to solve a problem (because you want to get something done now) is nowhere near as bad as, say, using/building an interpreter that is implemented in C (because I want to get something done "now", circa 1995). :) At Sun, 10 Aug 2014 10:38:24 -0400, S

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

2014-08-10 Thread Sean Kanaley
***The ultimate (programming) concern is what will produce the highest average correct-and-useful-running-program-output per second over my lifespan.*** (philosophical extensions: provided it doesn't hurt other people, unless they are "bad", where bad = ...etc...) Or anyone else who programs. The

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

2014-08-10 Thread Eli Barzilay
On Sun, Aug 10, 2014 at 3:59 AM, Matthew Flatt wrote: > > It's true that `eval` works as way to get reflective operations in > general, but it's better (again, for error checking and for > efficiency) when a language construct is accompanied with specific > reflective operations. [...] But if `ke

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

2014-08-10 Thread Eli Barzilay
On Sat, Aug 9, 2014 at 8:27 AM, Neil Van Dyke wrote: > Sounds like a good rule of thumb. Two suggestions to add: > > * Maybe there could also be a second rule of thumb, like, "If you need > arbitrary Racket expressions, then consider whether you can do it > with one of the following patterns:

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

2014-08-10 Thread Matthew Flatt
I think you're looking for `keyword-apply`. It's true that `eval` works as way to get reflective operations in general, but it's better (again, for error checking and for efficiency) when a language construct is accompanied with specific reflective operations. In the case of keyword arguments, tho

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

2014-08-09 Thread Alexander D. Knauth
Just for fun, I made a function to do this the “non-eval” way, and it was more complicated than I would have thought, although maybe I was overcomplicating it a bit? https://github.com/AlexKnauth/hash-lambda/blob/master/keyword-lambda/kw-apply.rkt On Aug 9, 2014, at 10:10 AM, Sean Kanaley wro

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

2014-08-09 Thread Sean Kanaley
Sorry, couple typos: mapply = map and l = lst. On Sat, Aug 9, 2014 at 10:10 AM, Sean Kanaley wrote: > There's a simple enough example I think: apply with keyword parameters. > Apply has that built-in..sort of...but the list is supposed to be provided > inline to APPLY, seemingly requiring apply

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

2014-08-09 Thread Sean Kanaley
There's a simple enough example I think: apply with keyword parameters. Apply has that built-in..sort of...but the list is supposed to be provided inline to APPLY, seemingly requiring apply to be applied (e.g. (apply apply (cons *thefunctiontoapply* params))), except keywords can't be expressions a

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

2014-08-09 Thread Neil Van Dyke
Sounds like a good rule of thumb. Two suggestions to add: * Maybe there could also be a second rule of thumb, like, "If you need arbitrary Racket expressions, then consider whether you can do it with one of the following patterns: [list some patterns involving combinations of syntax extension

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

2014-08-09 Thread Eli Barzilay
I think that I ran into a nice way to discourage eval except when needed: the rule of thumb is to only use eval when you need to evaluate any arbitrary (Racket) expression. It sounds simplistic but it covers lots of cases that make newbies run to eval: * I just want to get the value of a variable

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

2014-08-04 Thread Neil Van Dyke
Henry Lenzi wrote at 08/04/2014 07:43 PM: By the way, if you guys had any idea of the buggy stuff people sell to the health sector. The atrocious VB, MFC C++, Java... I'm not even goint to mention security.. Heh. I have seen some of that, and actually suggested to one of my consulting clients

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

2014-08-04 Thread Neil Van Dyke
Henry Lenzi wrote at 08/04/2014 07:21 PM: I was just wondering, Neil. what your experience in "production for pharmaceutical prescriptions/labeling/instructions" software would be. I'd be glad to read some stuff you've published or other software solutions, if it's not proprietary software. If i

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

2014-08-04 Thread Henry Lenzi
Hi Neil -- Thanks for the answer. Let's see... * Prevents much static checking. > not really an issue in this case (I don't see it). * Likely increased difficulty debugging ---> true. * Often executes arbitrary code with privileges, which might be corrupted due to accident or attack, which c

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

2014-08-04 Thread Henry Lenzi
I was just wondering, Neil. what your experience in "production for pharmaceutical prescriptions/labeling/instructions" software would be. I'd be glad to read some stuff you've published or other software solutions, if it's not proprietary software. If it is, what companies have you worked for in

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

2014-08-04 Thread Alexander D. Knauth
Oh sorry I meant this for parse-meds: (define (parse-meds lst) (match lst [(list) ""] [(list-rest MED QUANT FORM POS (? inst? INST) rest) (~a MED " " line " " QUANT " " FORM "\n" POS "\n" INST "\n" (parse-meds rest))] [(list-rest MED QUANT FORM POS rest) (~a MED " " line "

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

2014-08-04 Thread Alexander D. Knauth
Then would something like this work? #lang racket (provide (all-defined-out) #%datum #%top (rename-out [new-module-begin #%module-begin])) (define-syntax-rule (new-module-begin med-thing ...) (#%module-begin (displayln (parse-meds (list med-thing ...) (define (parse-med

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

2014-08-04 Thread Matthias Felleisen
On Aug 4, 2014, at 6:00 AM, Neil Van Dyke wrote: > > Matthew Flatt wrote at 08/04/2014 02:40 AM: >> While he didn't say so explicitly, I don't think that Neil is worried >> about the implementation of `eval` within Racket. After all, `eval` is >> at the heart of the implementation, and any prog

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

2014-08-04 Thread Neil Van Dyke
Matthew Flatt wrote at 08/04/2014 02:40 AM: While he didn't say so explicitly, I don't think that Neil is worried about the implementation of `eval` within Racket. After all, `eval` is at the heart of the implementation, and any program that you give to Racket is going through `eval` whether or

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

2014-08-03 Thread Matthew Flatt
At Mon, 4 Aug 2014 00:52:56 -0300, Henry Lenzi wrote: > What I'm sensing is that you seem to be concerned about bugs with > Racket Scheme's EVAL. Is that it? > I do not understand what the problem with EVAL is. Would you please > state clearly what the problems are? While he didn't say so explicit

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

2014-08-03 Thread Neil Van Dyke
Henry Lenzi wrote at 08/03/2014 11:52 PM: What I'm sensing is that you seem to be concerned about bugs with Racket Scheme's EVAL. Is that it? I do not understand what the problem with EVAL is. Would you please state clearly what the problems are? Eval is one of the issues. Sorry I have to be v

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

2014-08-03 Thread Henry Lenzi
Hello Alex -- This is nice, the problem is separating the output into the proper formatting. I feel this has to be done a step before the expansion into the string form. One thing I'm considering is that that the DSL is made of MED QUANT FORM POS or MED QUANT FOR POS INST, so 4 or 5 items. If we h

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

2014-08-03 Thread Alexander D. Knauth
Would this work for what you want? If med.rkt contains this: #lang racket (provide (all-defined-out) #%datum #%top (rename-out [new-module-begin #%module-begin])) (define-syntax-rule (new-module-begin med-thing ...) (#%module-begin (display (~a med-thing ... #:separator " "

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

2014-08-03 Thread Henry Lenzi
I would just like to add that this is only something very embrionary. There are a myriad ways to validate the user syntax when he/she provides input. We're just not there yet! ;-) Cheers, -- Henry On Mon, Aug 4, 2014 at 12:52 AM, Henry Lenzi wrote: > Hello Neil - > > First of all, I am not atte

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

2014-08-03 Thread Henry Lenzi
Hello Neil - First of all, I am not attempting tricks. I am doing the best I can, the way I know how to (I will take the "clever" part as a compliment, however). I have a few rational requirements, which I have explained. Foremost among them is code simplicity. I saw no need so far for parsers or

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

2014-08-03 Thread Neil Van Dyke
I can see how someone might want to do tricks like this, to use the REPL as user interface, for tinkering, and that could be very interesting or clever. However, just to be clear to students and professionals who might stumble upon this thread... If I were actually doing this in production fo

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

2014-08-03 Thread Henry Lenzi
Oh, OK. :-) -- Henry On Sun, Aug 3, 2014 at 9:38 PM, Alexander D. Knauth wrote: > > On Aug 3, 2014, at 7:58 PM, Henry Lenzi wrote: > >> Alexander's idea is interesting, but it onlt works if the >> prescription file is not numbered (which is actually more natural), >> such as if it were: >> hctz

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

2014-08-03 Thread Alexander D. Knauth
On Aug 3, 2014, at 7:58 PM, Henry Lenzi wrote: > Alexander's idea is interesting, but it onlt works if the > prescription file is not numbered (which is actually more natural), > such as if it were: > hctz25 30 pl 1xd > simva20 30 pl 1xn > >> (define in2 (open-input-file "Recipe3.txt")) >> (por

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

2014-08-03 Thread Henry Lenzi
Alexander's idea is interesting, but it onlt works if the prescription file is not numbered (which is actually more natural), such as if it were: hctz25 30 pl 1xd simva20 30 pl 1xn > (define in2 (open-input-file "Recipe3.txt")) > (port->list (compose1 eval read) in2) '("Hydrochlorothiazide 25mg"

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

2014-08-03 Thread Alexander D. Knauth
On Aug 3, 2014, at 4:29 PM, Alexander D. Knauth wrote: > > On Aug 3, 2014, at 3:29 PM, Henry Lenzi wrote: > >> ; Hello all -- >> ; So here's how I solve all those little problems regarding symbols >> and evaluation of medication definitions. >> ; Would you please bear with me? I apologize for

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

2014-08-03 Thread Henry Lenzi
Alexander -- Thanks. But what would "thing" be? On Sun, Aug 3, 2014 at 5:29 PM, Alexander D. Knauth wrote: > > On Aug 3, 2014, at 3:29 PM, Henry Lenzi wrote: > >> ; Hello all -- >> ; So here's how I solve all those little problems regarding symbols >> and evaluation of medication definitions. >

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

2014-08-03 Thread Alexander D. Knauth
On Aug 3, 2014, at 3:29 PM, Henry Lenzi wrote: > ; Hello all -- > ; So here's how I solve all those little problems regarding symbols > and evaluation of medication definitions. > ; Would you please bear with me? I apologize for the length. > ; This is the approach I've taken. I've chosen no to

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

2014-08-03 Thread Henry Lenzi
It's best if I use pasteracket ("Hank's medication thingy") http://pasterack.org/pastes/14535 -- Henry Lenzi On Sun, Aug 3, 2014 at 4:30 PM, Henry Lenzi wrote: > Uh oh, the GOOG botched formatting. Sorry about that! > > On Sun, Aug 3, 2014 at 4:29 PM, Henry Lenzi wrote: >> ; Hello all -- >> ;

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

2014-08-03 Thread Henry Lenzi
Uh oh, the GOOG botched formatting. Sorry about that! On Sun, Aug 3, 2014 at 4:29 PM, Henry Lenzi wrote: > ; Hello all -- > ; So here's how I solve all those little problems regarding symbols > and evaluation of medication definitions. > ; Would you please bear with me? I apologize for the length

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

2014-08-03 Thread Henry Lenzi
; Hello all -- ; So here's how I solve all those little problems regarding symbols and evaluation of medication definitions. ; Would you please bear with me? I apologize for the length. ; This is the approach I've taken. I've chosen no to use any macrology or parser/lexer technique because I don't

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

2014-08-01 Thread Henry Lenzi
Hello everyone - First of all, a big Thank You to all of you and for taking the time for responding. I'll have to set aside sometime during this weekend to see if I can understand the ideas you've been so kind to offer. However, I should confess that I've made some progress with way simpler stuf

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

2014-07-31 Thread Vincent St-Amour
At Wed, 30 Jul 2014 22:57:59 -0300, Henry Lenzi wrote: > This might lead to having hundreds of definition files, however (say, > one for each medication defintion). If you want. You can have as many definitions per file as you'd like, though, so you don't have to. When you import a module, all it

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

2014-07-31 Thread Matthias Felleisen
On Jul 30, 2014, at 9:57 PM, Henry Lenzi wrote: > This might lead to having hundreds of definition files, however (say, > one for each medication defintion). Use sub-modules and load them: #lang racket (module prescription1 PPL ...) (module prescription2 PPL ...) etc. Your PPL (prescri

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

2014-07-31 Thread Daniel Prager
Hi Henry I'm taking a similar approach to Galler for a proof-of-concept, but without the macrology. This should make the ideas more widely accessible (and my skill with macros is limited). First, thank-you again for supplying the example. By comparing input and output readers can infer the kinds

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

2014-07-30 Thread Galler
Henri Is this what you're after? #lang racket/base (require (for-syntax syntax/parse racket/base )) (provide make-script) (begin-for-syntax (define-syntax-class unit-dictionary #:attributes (str) (pattern (~literal p) #:wit

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

2014-07-30 Thread Henry Lenzi
How do you tell Racket Scheme to save a module (programatically, that is)? I only see syntax for importing modules in the documentation. Is that even possible? TIA, Henry On Mon, Jul 28, 2014 at 6:03 PM, Vincent St-Amour wrote: > Henry, > > It looks like modules may be what you're looking for.

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

2014-07-30 Thread Henry Lenzi
Actually, it occurred to me that re-assembling the symbols in the recipe/module might involve macrology, in order to put in the following format: MEDICATION QUANTITY LINE NUMBER FORM INSTRUCTIONS (that's like OMZ20 30CP INSTOMZ that I exemplified in another message, expanding to: Omeprazol 20mg

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

2014-07-30 Thread Henry Lenzi
Actually, this is interesting. This might lead to having hundreds of definition files, however (say, one for each medication defintion). I would have to look into how I can save a module to a file (Alexander Knauth explained that (write '(define hctz25 "Hydrochlorothiazide 25mg") out) would write

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

2014-07-30 Thread Henry Lenzi
Hi Dan -- What you saw was precisely the database file (it's a file written in the programming language FORTH). Cheers, Henry On Wed, Jul 30, 2014 at 10:48 PM, Daniel Prager wrote: > Thanks Henry > > That's exactly what I was interested in. I'm at work at the moment > (Australia), but will have

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

2014-07-30 Thread Daniel Prager
Thanks Henry That's exactly what I was interested in. I'm at work at the moment (Australia), but will have a bit more of a look later tonight But I have an interest in the health sector, and would be interested in contributing to a public domain project, especially if we can make something neat /

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

2014-07-30 Thread Henry Lenzi
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 ow

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

2014-07-30 Thread Robby Findler
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 wrote: > Hi Daniel -- > > Do you mean the Forth fil

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

2014-07-30 Thread Henry Lenzi
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: S

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

2014-07-30 Thread Daniel Prager
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 exa

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

2014-07-30 Thread Alexander D. Knauth
On Jul 29, 2014, at 11:42 PM, Henry Lenzi wrote: > (read in) doesn't work. > > This should be simple...I write >> (define out (open-output-file "Recipe.txt")) >> (print *med-name* out) What you probably want here is write, not print. >> (close-output-port out) Print is good for printing values

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

2014-07-30 Thread Andrew Dudash
> > Thanks, Vincent. But a recipe is more than those simple definitions. > Actually, it would be something like: > MEDICATION DOSE UNITS - QUANTITY FORM > INSTRUCTIONS FOR TAKING MEDICATION The module idea would still work. You can define your definitions in one file, provi

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

2014-07-29 Thread Henry Lenzi
(read in) doesn't work. This should be simple...I write > (define out (open-output-file "Recipe.txt")) > (print *med-name* out) > (close-output-port out) and what I see in the file is: 'hctz25 How can I import this from a file? If I use (read in), I get: ''hctz25 (two quotes) The issue here w

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

2014-07-29 Thread Henry Lenzi
Thanks, Vincent. But a recipe is more than those simple definitions. Actually, it would be something like: MEDICATION DOSE UNITS - QUANTITY FORM INSTRUCTIONS FOR TAKING MEDICATION In my previous Forth version, this was extremely easy to achieve, as Forth is syntax-less, and

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

2014-07-28 Thread Alexander D. Knauth
I don’t think you even need to serialize it for that: (define my-hash (make-hash)) (define out (open-output-file “dump.dat”)) (write my-hash out) (close-output-port out) … later (define in (open-input-file “dump.dat”)) (define my-hash (read in)) (close-input-port in) On Jul 28, 2014, at 11:59 PM,

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

2014-07-28 Thread Roman Klochkov
You may also export all hash to file and later read it. http://docs.racket-lang.org/reference/serialization.html (require racket/serialize) (define my-hash (make-hash)) (define out (open-output-file "dump.dat")) (write (serialize my-hash) out) (close-output-port out) ... later (define in (ope

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

2014-07-28 Thread Neil Van Dyke
If we keep a human in the loop, we can see how users respond to the different messages, and adapt our form of expression as necessary. If all else fails, the nuclear option: viral YouTube video of "Don't use eval" as interpretive dance. Neil V. Matthias Felleisen wrote at 07/28/2014 02:46 PM:

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

2014-07-28 Thread Matthias Felleisen
Neil, I think that would be a wonderful service that you could script as a little Racket daemon. It could broadcast this message every quarter or so (as an addendum to PLT Design Inc's financial statement) and the broadcast could take different shapes and forms and use different words (FAQ, TLL

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

2014-07-28 Thread Alexander D. Knauth
On Jul 28, 2014, at 4:21 PM, Henry Lenzi wrote: > Hi Neil -- > > So how do you export hash keys as symbols to a file that can be read > in again, not as string? > > Now, I haven't gotten around to reading the whole of Racket Scheme's > documentation... Things are looking kind of hard. > > Wha

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

2014-07-28 Thread Vincent St-Amour
Henry, It looks like modules may be what you're looking for. You could have a file that defines a substance and exports it ;; a.rkt #lang racket (provide hctz25) (define hctz25 "Hydrochlorothiazide 25mg") and then a recipe file that imports the previous file #lang racket

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

2014-07-28 Thread Henry Lenzi
Hi Neil -- So how do you export hash keys as symbols to a file that can be read in again, not as string? Now, I haven't gotten around to reading the whole of Racket Scheme's documentation... Things are looking kind of hard. What I'm attempting to do is then read back the symbols defined, such as

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

2014-07-28 Thread Neil Van Dyke
I don't know the current state of the "eval" docs in the manual, but I think they should have a big warning at the very front, intended to scare away newbies. Remember that Racket is often used in conjunction with many different Scheme-based and other Lisp-based textbooks and courses. It seems

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

2014-07-28 Thread Henry Lenzi
Hello again- I suppose this doesn't look like a case for eval when you first look into it, but since I would like to export the shorthand symbols to a file, I just might need eval. - Henry. Em domingo, 27 de julho de 2014, Pierpaolo Bernardi escreveu: > On Sun, Jul 27, 2014 at 5:10 AM, Henry L

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

2014-07-28 Thread Henry Lenzi
Em domingo, 27 de julho de 2014, Matthew Butterick escreveu: > Because *med-name* is different. The other three are the names of > variables that hold strings. But *med-name* is the name of a variable that > holds the name of another variable that holds a > > Yes, always good to be reminded about

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

2014-07-28 Thread Vincent St-Amour
Maybe this should be linked to from the `eval' docs? http://blog.racket-lang.org/2011/10/on-eval-in-dynamic-languages-generally.html Vincent At Sun, 27 Jul 2014 16:16:52 -0400, Neil Van Dyke wrote: > > Maybe there should be a periodic public service announcement about not > using "eval". This

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

2014-07-27 Thread Neil Van Dyke
Maybe there should be a periodic public service announcement about not using "eval". This time I will communicate in FAQ format: Q: How do I use eval? A: Don't use eval. Q: But don't so many academic books feature eval prominently, so doesn't that mean I should use try to eval? A: Those books

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

2014-07-27 Thread Henry Lenzi
By the way, just out of curiosity, why do I need to nest EVALs. E.g., this won't work (notwithstanding the namespace issue in the definitions panel, just using the REPL): > (map eval '(*med-name* line *quant-str* pl)) '(hctz25 "---" "30" "pills") Why wasn't the symbol "hctz25" expanded? I

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

2014-07-27 Thread Henry Lenzi
Thanks for your answers. - Henry Lenzi On Sun, Jul 27, 2014 at 2:36 AM, Matthew Butterick wrote: > The REPL automatically uses the current namespace, which is why you can > casually use eval there without specifying a namespace. [1] > > But if you're using eval in the definitions window, you nee

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

2014-07-26 Thread Matthew Butterick
The REPL automatically uses the current namespace, which is why you can casually use eval there without specifying a namespace. [1] But if you're using eval in the definitions window, you need to give it a namespace, otherwise you'll get "unbound identifier" errors. In this case, the namespace

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

2014-07-26 Thread Pierpaolo Bernardi
On Sun, Jul 27, 2014 at 5:10 AM, Henry Lenzi wrote: > #lang racket > > #| > > Dear Racketeers - > > I would like to create a little function > that would write a line of a medical recipe. > > I would pass to "read" a shorthand form, > and the program would expand the text. Like so: > > When I answ