Re: [racket-users] Creating a list of random things

2016-10-25 Thread Ben Greenman
Or: (build-list n (lambda (dont-care) (make-random-string))) On Tue, Oct 25, 2016 at 10:42 PM, Robby Findler wrote: > I would probably write that function like this: > > #lang racket > > (provide > (contract-out > [make-a-string (-> non-empty-string?

Re: [racket-users] Creating a list of random things

2016-10-25 Thread Robby Findler
I would probably write that function like this: #lang racket (provide (contract-out [make-a-string (-> non-empty-string? string?)])) (define (make-a-string candidates) (apply string (for/list ([i (in-range (random 100))]) (string-ref candidates (random (string-length

[racket-users] Creating a list of random things

2016-10-25 Thread Meino . Cramer
Hi, I want to create a list of random strings. For that I have created a function, which returns a string of random length and random contents. Then I used make-list n (make-random-string) to create that listand get back a list filled with n identical strings. h... make-list

Re: [racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-25 Thread Ryan Culpepper
On 10/25/2016 08:04 PM, Alexis King wrote: That makes sense; thank you for your quick reply. It might be possible to do something like what you describe, but I do have a little more context that makes this sort of tricky. I’m trying to not just store identifiers but also store prefab structs

Re: [racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-25 Thread Alexis King
That makes sense; thank you for your quick reply. It might be possible to do something like what you describe, but I do have a little more context that makes this sort of tricky. I’m trying to not just store identifiers but also store prefab structs containing identifiers. The issue I’m running

Re: [racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-25 Thread Matthew Flatt
Putting identifiers in syntax properties causes them to be hidden from various scope and module-path-shifting operations. Probably, you're seeing the effect of hiding an identifier from path shifting (when an expanded module is compiled or when a compiled module is declared and instantiated in at

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Ryan Culpepper
On 10/25/2016 06:16 PM, Dan Liebgold wrote: On Tuesday, October 25, 2016 at 2:09:59 PM UTC-7, Ryan Culpepper wrote: racket -e '(enter! "your-module.rkt")' -i BTW, any luck putting a line like this in csh shell script, alias, or windows batch file? For scripting, if your interactions

[racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-25 Thread Alexis King
In the language I am working on, I store identifiers in preserved syntax properties to attach type information to pieces of syntax. More specifically, I store identifiers inside prefab structs, which are then stored within preserved syntax properties. This seems to work fine when my program spans

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 3:20:47 PM UTC-7, Alexis King wrote: > > Note that if you have a #lang that provides a custom reader, I don’t > think this will work quite right. However, if you have a configure-runtime Fortunately my language uses "#lang s-exp syntax/module-reader" as it's reader

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Alexis King
> On Oct 25, 2016, at 2:09 PM, Ryan Culpepper wrote: > > It sounds like you want the behavior of the `enter!` command. You can kind of > do that from the command line like this: > > racket -e '(enter! "your-module.rkt")' -i > > Ryan Note that if you have a #lang that

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 2:09:59 PM UTC-7, Ryan Culpepper wrote: > >racket -e '(enter! "your-module.rkt")' -i > BTW, any luck putting a line like this in csh shell script, alias, or windows batch file? -- You received this message because you are subscribed to the Google Groups

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 2:09:59 PM UTC-7, Ryan Culpepper wrote: > >racket -e '(enter! "your-module.rkt")' -i > That's it. Thanks! -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 2:09:59 PM UTC-7, Ryan Culpepper wrote: > On 10/25/2016 04:57 PM, Dan Liebgold wrote: > > On Tuesday, October 25, 2016 at 1:43:28 PM UTC-7, Alexis King wrote: > > bound... > >> > >> You need to put the -i flag first, so the command should look like: > >> > >>

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Ryan Culpepper
On 10/25/2016 04:57 PM, Dan Liebgold wrote: On Tuesday, October 25, 2016 at 1:43:28 PM UTC-7, Alexis King wrote: bound... You need to put the -i flag first, so the command should look like: racket -iI -l Hmm... that give the REPL the proper language but no access to the contents of

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 1:43:28 PM UTC-7, Alexis King wrote: bound... > > You need to put the -i flag first, so the command should look like: > > racket -iI -l > Hmm... that give the REPL the proper language but no access to the contents of ... -- You received this message

Re: [racket-users] racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 1:28:08 PM UTC-7, Alexis King wrote: > The short answer is “no, but you can use -I to achieve a similar > effect for some languages”. > This is unfortunate. Ideally, I'd replicate Dr Racket's interactions window after running a module. -- You received this

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Alexis King
> On Oct 25, 2016, at 1:33 PM, Dan Liebgold wrote: > > I use -I, -l, then -i but the resulting REPL has no #%top-interaction > bound... You need to put the -i flag first, so the command should look like: racket -iI -l The reason for this is buried towards

[racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 1:33:18 PM UTC-7, Dan Liebgold wrote: > I use -I, -l, then -i but the resulting REPL has no #%top-interaction bound... Hrm.. -I and -l look pretty much identical... is there a guide to formatting these posts? -- You received this message because you are

[racket-users] Re: racket command line parameter

2016-10-25 Thread Dan Liebgold
On Tuesday, October 25, 2016 at 1:06:17 PM UTC-7, Dan Liebgold wrote: > Is there a racket command line parameter that will enable me to start a REPL > (using -i) within a module context? Specifically I'd like the REPL to star > as if within a certain "#lang ". > Ok, I've used the -I parameter

Re: [racket-users] racket command line parameter

2016-10-25 Thread Alexis King
The short answer is “no, but you can use -I to achieve a similar effect for some languages”. The longer answer is as follows. The way the REPL is configured is different from the way modules’ readers are configured. The #lang protocol is relatively simple — you provide read and read-syntax — but

[racket-users] racket command line parameter

2016-10-25 Thread Dan Liebgold
Is there a racket command line parameter that will enable me to start a REPL (using -i) within a module context? Specifically I'd like the REPL to star as if within a certain "#lang ". Thanks, Dan -- You received this message because you are subscribed to the Google Groups "Racket Users"

Re: [racket-users] Error messages in DSL implementations

2016-10-25 Thread Matthias Felleisen
Konrad, you may wish to work with Stephen whose latest research project is about combining static checking with expansion so that you don’t separate those two steps. > On Oct 25, 2016, at 6:20 AM, Konrad Hinsen wrote: > > Thanks to Dmitry, Matthias, and Alexis

[racket-users] Re: Redex: macro expanding to a side-condition clause

2016-10-25 Thread Dupéron Georges
Sam, would something like this work for you? I'm using the generic-syntax-expanders library to easily define expanders (sorts of macros) which are expanded within uses of a wrapper of define-judgment-form. #lang racket (require (rename-in redex [define-judgment-form

Re: [racket-users] Error messages in DSL implementations

2016-10-25 Thread Konrad Hinsen
Thanks to Dmitry, Matthias, and Alexis for their comments, which were very helpful to understand the principles of error reporting in DSLs. My summary is (please correct me if I am wrong!): 1) If my DSL code expands to Racket code doing error checking/reporting at the top level, the syntax