Re: [racket] How to make an identifier that will have a certain binding no matter what phase level it's referenced at?

2014-07-28 Thread Matthew Flatt
It's not just a question of having `lambda` bound at the right phase, but also of ensuring that the module implementing `lambda` is instantiated at the right time and phase. The `require` form takes care of both jobs, and the fact that it binds and creates an instantiation dependency at the same

Re: [racket] module-level definitions vs. local definitions and how binding works

2014-07-28 Thread Matthew Flatt
The result for the local-binding case looks like a bug to me, and it looks like the kind of bug that will take a while to fix. (I think it's a problem with the current representation of syntax objects and the way that module-level lexical information interacts with local-binding information.)

Re: [racket] hygienic read-macros (was: module-level definitions vs. local definitions and how binding works)

2014-07-28 Thread Roman Klochkov
You may use such macro for making hygienic read-macros (define-syntax (make-reader stx) (syntax-case stx () [(_ NAME BODY ...) (with-syntax ([GENSYM (datum-syntax stx (gensym))]) #'(begin (define-syntax (GENSYM stx) (syntax-case stx ()

Re: [racket] hygienic read-macros (was: module-level definitions vs. local definitions and how binding works)

2014-07-28 Thread Alexander D. Knauth
Well that works fine when it’s in the same module (or namespace), but when I put it in a #lang, it breaks and I get this error: experiment-with-hygenic-reader-extensions/try-it.rkt: #lang experiment-with-hygenic-reader-extensions $ ; g15667: unbound identifier in module in: g15667 That’s one

[racket] Minimal graphical UI

2014-07-28 Thread Steve Lloyd
I’m wondering what is the current status of gracket - given the warning message displayed on startup? I’m after a minimal interactions window which can be used for demoing simple Racket constructs (including graphical) without the relative complexity of drracket, on the raspberry pi (which also

Re: [racket] Minimal graphical UI

2014-07-28 Thread Matthew Flatt
If you don't need anything better, then it's fine to use GRacket's default REPL. We have no plans to change it. At Mon, 28 Jul 2014 16:34:16 +0100, Steve Lloyd wrote: I’m wondering what is the current status of gracket - given the warning message displayed on startup? I’m after a minimal

Re: [racket] hygienic read-macros (was: module-level definitions vs. local definitions and how binding works)

2014-07-28 Thread Alexander D. Knauth
On Jul 28, 2014, at 11:41 AM, Roman Klochkov kalimeh...@mail.ru wrote: I tried to make it with module (module m racket (define-syntax (make-reader stx) (syntax-case stx () [(_ NAME BODY ...) (with-syntax ([GENSYM (datum-syntax stx (gensym))]) #'(begin

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-28 Thread Henry Lenzi
Em domingo, 27 de julho de 2014, Matthew Butterick m...@mbtype.com 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

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
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

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 Alexander D. Knauth
On Jul 28, 2014, at 4:21 PM, Henry Lenzi henry.le...@gmail.com 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

Re: [racket] hygienic read-macros (was: module-level definitions vs. local definitions and how binding works)

2014-07-28 Thread Roman Klochkov
Mon, 28 Jul 2014 13:51:12 -0400 от Alexander D. Knauth alexan...@knauth.org: On Jul 28, 2014, at 11:41 AM, Roman Klochkov kalimeh...@mail.ru wrote: I tried to make it with module . (require 'm) Works just fine Yes because GENSYM was provided by ‘m, but if it’s a #lang then that

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,

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] hygienic read-macros (was: module-level definitions vs. local definitions and how binding works)

2014-07-28 Thread Alexander D. Knauth
On Jul 28, 2014, at 10:15 PM, Roman Klochkov kalimeh...@mail.ru wrote: Mon, 28 Jul 2014 13:51:12 -0400 от Alexander D. Knauth alexan...@knauth.org: On Jul 28, 2014, at 11:41 AM, Roman Klochkov kalimeh...@mail.ru wrote: I tried to make it with module . (require 'm)

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

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