Re: [racket-users] Why is struct/contract so much faster than a guard?

2020-09-02 Thread Christopher Lemmer Webber
Philip McGrath writes:

> On Wed, Sep 2, 2020 at 3:41 PM Christopher Lemmer Webber <
> cweb...@dustycloud.org> wrote:
>
>> Unfortunately I can't use #:methods with struct/contract so I'm stuck
>> with the slow one if I want a contract on the struct?
>>
>
> For another option (though you may already know this), I'd advocate for
> using the `struct` sub-form of `contract-out` and drawing the module
> boundary as tightly as needed to make it a sensible boundary for trust,
> potentially by using submodules.

Yes... probably what I should do in the future.

> Since you mention `#:methods` in particular, you should be aware of some
> subtle corners that make it tricky (and potentially expensive at runtime)
> to protect  `racket/generic` methods comprehensively with contracts. (Here's
> a pointer to some discussions.
> ) I think just working with
> struct-type properties can make sense when you don't really need most of
> the features `racket/generic` gives you.

:O

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/87wo1ba8c1.fsf%40dustycloud.org.


Re: [racket-users] Why is struct/contract so much faster than a guard?

2020-09-02 Thread Christopher Lemmer Webber
Ah, I didn't know one could just write a function for the guard... but
that makes a lot of sense!

Sam Tobin-Hochstadt writes:

> The issue is that `struct-guard/c` is slow. If you just write a
> function as a guard it's faster than `struct/contract`.
>
> Sam
>
> On Wed, Sep 2, 2020 at 3:41 PM Christopher Lemmer Webber
>  wrote:
>>
>> I tested the following:
>>
>>   (struct foo (bar baz)
>> #:guard (struct-guard/c any/c list?))
>>
>> and:
>>
>>   (struct/contract foo ([bar any/c]
>> [baz list?]))
>>
>> With the first:
>>
>>   test> (time
>>  (for ([i 100])
>>(foo 'yeah '(buddy
>>   cpu time: 2601 real time: 2599 gc time: 7
>>
>> With the second:
>>
>>   test> (time
>>  (for ([i 100])
>>(foo 'yeah '(buddy
>>   cpu time: 184 real time: 184 gc time: 13
>>
>> Wow, what the heck?  That's about a 10x difference.  What?!?!?
>> Why would #:guard be so damn slow in comparison?  You'd think they'd be
>> doing the same thing.
>>
>> Unfortunately I can't use #:methods with struct/contract so I'm stuck
>> with the slow one if I want a contract on the struct?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/873640arw7.fsf%40dustycloud.org.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/87zh67a8cy.fsf%40dustycloud.org.


Re: [racket-users] Why is struct/contract so much faster than a guard?

2020-09-02 Thread Philip McGrath
On Wed, Sep 2, 2020 at 3:41 PM Christopher Lemmer Webber <
cweb...@dustycloud.org> wrote:

> Unfortunately I can't use #:methods with struct/contract so I'm stuck
> with the slow one if I want a contract on the struct?
>

For another option (though you may already know this), I'd advocate for
using the `struct` sub-form of `contract-out` and drawing the module
boundary as tightly as needed to make it a sensible boundary for trust,
potentially by using submodules.

Since you mention `#:methods` in particular, you should be aware of some
subtle corners that make it tricky (and potentially expensive at runtime)
to protect  `racket/generic` methods comprehensively with contracts. (Here's
a pointer to some discussions.
) I think just working with
struct-type properties can make sense when you don't really need most of
the features `racket/generic` gives you.

-Philip

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/0100017450ed66ea-e1b5b7a3-11cf-416b-bcab-dc314bc692b2-00%40email.amazonses.com.


Re: [racket-users] Create C functions for embedded Racket CS

2020-09-02 Thread Hendrik Boom
On Wed, Sep 02, 2020 at 02:05:11PM -0700, dotoscat wrote:
> There are a function such scheme_make_prim_w_arity 
> 
> for the CS version? 

> The idea is to use Racket
> as a scripting language for a C program.

That's what guile was designed for.
How does Racket measure up as a scripting language for C?

-- hendrik

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200902213805.44xhu4mncp7s4wyi%40topoi.pooq.com.


[racket-users] Create C functions for embedded Racket CS

2020-09-02 Thread dotoscat
There are a function such scheme_make_prim_w_arity 

for the CS version? The idea is to use Racket
as a scripting language for a C program.

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1f083198-3840-4850-8aaf-cddac8a2ba76n%40googlegroups.com.


Re: [racket-users] provide-if-not-defined

2020-09-02 Thread Sorawee Porncharoenwase
IIUC, that’s not what Shriram wants. He wants a kind of interface /
contract for a module (that it must export certain identifiers). The
solution that you posted makes the module satisfy the interface by
construction, but it creates another problem which is that he might
accidentally export a wrong identifier.

Wouldn’t create a test file suffice for detecting the original problem that
Shriram has, though? Something like this:

;; tester.rkt
#lang racket/base

(define required-ids '(+ - *))
(define files '("test-a.rkt" "test-b.rkt" "test-c.rkt"))

(define (error-handler e)
  ((error-display-handler) (exn-message e) e))

(for ([mod (in-list files)])
  (parameterize ([current-namespace (make-base-namespace)])
(with-handlers ([exn:fail:syntax? error-handler])
  (expand
   `(module test racket/base
  (require (only-in ,mod ,@required-ids)))

;; test-a.rkt
#lang racket/base
(provide + *)

;; test-b.rkt
#lang racket/base

(provide (rename-out [my-+ +]) - *)

(define (my-+ a b)
  (+ a b 1))

;; test-c.rkt
#lang racket/base
(provide + -)

which produces:

only-in: identifier `-' not included in nested require spec in: "test-a.rkt"
only-in: identifier `*' not included in nested require spec in: "test-c.rkt"



On Wed, Sep 2, 2020, 1:12 PM Michael MacLeod 
wrote:

> Does this example work: http://pasterack.org/pastes/95923?
>
> `if-not-defined` is written as a provide transformer which uses
> `syntax-local-module-defined-identifiers` to get the list of phase-0
> identifiers defined in the module.
>
> Best,
> Michael
>
> [code also pasted below]:
>
> #lang racket/base
>
> (module implementation racket/base
>   (provide (if-not-defined "^my-"
>+ ; my-+ from this module
>- ; - from racket/base
>* ; my-* from this module
>/ ; / from racket/base
>))
>
>   (require (for-syntax racket/base
>racket/provide-transform
>syntax/parse))
>
>   (define-syntax if-not-defined
> (make-provide-transformer
>  (lambda (stx modes)
>(syntax-parse stx
>  [(_ pattern:string var:id ...)
>   (define regex (regexp (syntax-e #'pattern)))
>   (define phase-0-ids
> (hash-ref (syntax-local-module-defined-identifiers) 0))
>   (define (find-id+sym v)
> (define v-string (symbol->string (syntax-e v)))
> (for/or ([id (in-list phase-0-ids)])
>   (define id-string (symbol->string (syntax-e id)))
>   (define maybe-match
> (and (string=? v-string
>(regexp-replace regex id-string ""))
>  (not (string=? id-string v-string
>   (if maybe-match
>   (cons id
> (string->symbol v-string))
>   #f)))
>   (for/fold ([exports '()])
> ([v (in-list (syntax->list #'(var ...)))])
> (define maybe-id+sym (find-id+sym v))
> (cond [maybe-id+sym
>(cons (export (car maybe-id+sym)
>  (cdr maybe-id+sym)
>  0
>  #f
>  (car maybe-id+sym))
>  exports)]
>   [else
>(cons (export v
>  (syntax-e v)
>  0
>  #f
>  v)
>  exports)]))]
>
>   (define (my-+ a b)
> (+ a b 100))
>
>   (define (my-* a b)
> (* a b 100)))
>
> (require 'implementation rackunit)
>
> (check-equal? (+ 2 3) 105)
> (check-equal? (- 2 3) -1)
> (check-equal? (* 2 3) 600)
> (check-equal? (/ 2 3) 2/3)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CACehHmBAd%2BhNHsO3CkthY5ojuZ%2B_Rgj87rKbQrPXrAw5Fxcw7w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegtUnfR2S_-yZV%2BNHcB4AxgeLkntmi%2BV318YVWnXaw%3D0EQ%40mail.gmail.com.


Re: [racket-users] Why is struct/contract so much faster than a guard?

2020-09-02 Thread Sam Tobin-Hochstadt
The issue is that `struct-guard/c` is slow. If you just write a
function as a guard it's faster than `struct/contract`.

Sam

On Wed, Sep 2, 2020 at 3:41 PM Christopher Lemmer Webber
 wrote:
>
> I tested the following:
>
>   (struct foo (bar baz)
> #:guard (struct-guard/c any/c list?))
>
> and:
>
>   (struct/contract foo ([bar any/c]
> [baz list?]))
>
> With the first:
>
>   test> (time
>  (for ([i 100])
>(foo 'yeah '(buddy
>   cpu time: 2601 real time: 2599 gc time: 7
>
> With the second:
>
>   test> (time
>  (for ([i 100])
>(foo 'yeah '(buddy
>   cpu time: 184 real time: 184 gc time: 13
>
> Wow, what the heck?  That's about a 10x difference.  What?!?!?
> Why would #:guard be so damn slow in comparison?  You'd think they'd be
> doing the same thing.
>
> Unfortunately I can't use #:methods with struct/contract so I'm stuck
> with the slow one if I want a contract on the struct?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/873640arw7.fsf%40dustycloud.org.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BbX8B9vknFmzqsrnQDkyUmcfnDfio7-LoC1efwAuxSfqA%40mail.gmail.com.


Re: [racket-users] provide-if-not-defined

2020-09-02 Thread Michael MacLeod
Does this example work: http://pasterack.org/pastes/95923?

`if-not-defined` is written as a provide transformer which uses
`syntax-local-module-defined-identifiers` to get the list of phase-0
identifiers defined in the module.

Best,
Michael

[code also pasted below]:

#lang racket/base

(module implementation racket/base
  (provide (if-not-defined "^my-"
   + ; my-+ from this module
   - ; - from racket/base
   * ; my-* from this module
   / ; / from racket/base
   ))

  (require (for-syntax racket/base
   racket/provide-transform
   syntax/parse))

  (define-syntax if-not-defined
(make-provide-transformer
 (lambda (stx modes)
   (syntax-parse stx
 [(_ pattern:string var:id ...)
  (define regex (regexp (syntax-e #'pattern)))
  (define phase-0-ids
(hash-ref (syntax-local-module-defined-identifiers) 0))
  (define (find-id+sym v)
(define v-string (symbol->string (syntax-e v)))
(for/or ([id (in-list phase-0-ids)])
  (define id-string (symbol->string (syntax-e id)))
  (define maybe-match
(and (string=? v-string
   (regexp-replace regex id-string ""))
 (not (string=? id-string v-string
  (if maybe-match
  (cons id
(string->symbol v-string))
  #f)))
  (for/fold ([exports '()])
([v (in-list (syntax->list #'(var ...)))])
(define maybe-id+sym (find-id+sym v))
(cond [maybe-id+sym
   (cons (export (car maybe-id+sym)
 (cdr maybe-id+sym)
 0
 #f
 (car maybe-id+sym))
 exports)]
  [else
   (cons (export v
 (syntax-e v)
 0
 #f
 v)
 exports)]))]

  (define (my-+ a b)
(+ a b 100))

  (define (my-* a b)
(* a b 100)))

(require 'implementation rackunit)

(check-equal? (+ 2 3) 105)
(check-equal? (- 2 3) -1)
(check-equal? (* 2 3) 600)
(check-equal? (/ 2 3) 2/3)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CACehHmBAd%2BhNHsO3CkthY5ojuZ%2B_Rgj87rKbQrPXrAw5Fxcw7w%40mail.gmail.com.


[racket-users] difference in struct printing from default #:transparent versus make-constructor-style-printer

2020-09-02 Thread Jeremy Siek
I'm seeing some bad behavior from make-constructor-style-printer when
there are lists mixed in with the structs. It seems to switch from print 
mode to
write mode when going under a list. Whereas the default printer for 
transparent structs gets this right. The following program demonstrates the 
difference/problem.
Any thoughts on how to get the make-constructor-style-printer to behave
properly?

#lang racket
(require racket/struct)

(struct Int1 (value) #:transparent)
(struct Prim1 (op arg*) #:transparent)

(struct Int2 (value) #:transparent
  #:methods gen:custom-write
  [(define write-proc
 (make-constructor-style-printer
  (lambda (obj) 'Int2)
  (lambda (obj) (list (Int2-value obj)])
(struct Prim2 (op arg*) #:transparent
  #:methods gen:custom-write
  [(define write-proc
 (make-constructor-style-printer
  (lambda (obj) 'Prim2)
  (lambda (obj) (list (Prim2-op obj) (Prim2-arg* obj)])

(define p1 (Prim1 '+ (list (Int1 1) (Int1 2
(print p1)(newline)

(define p2 (Prim2 '+ (list (Int2 1) (Int2 2
(print p2)(newline)

The output is:

(Prim1 '+ (list (Int1 1) (Int1 2)))
(Prim2 '+ '(# #))

-Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/bdeb1052-ea25-4dc0-8292-a13d15bf7870n%40googlegroups.com.


[racket-users] Why is struct/contract so much faster than a guard?

2020-09-02 Thread Christopher Lemmer Webber
I tested the following:

  (struct foo (bar baz)
#:guard (struct-guard/c any/c list?))

and:

  (struct/contract foo ([bar any/c]
[baz list?]))

With the first:

  test> (time
 (for ([i 100])
   (foo 'yeah '(buddy
  cpu time: 2601 real time: 2599 gc time: 7

With the second:

  test> (time
 (for ([i 100])
   (foo 'yeah '(buddy
  cpu time: 184 real time: 184 gc time: 13

Wow, what the heck?  That's about a 10x difference.  What?!?!?
Why would #:guard be so damn slow in comparison?  You'd think they'd be
doing the same thing.

Unfortunately I can't use #:methods with struct/contract so I'm stuck
with the slow one if I want a contract on the struct?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/873640arw7.fsf%40dustycloud.org.


[racket-users] Re: consistent interfaces from multiple files

2020-09-02 Thread Shriram Krishnamurthi
I realize I could have used `define-language` and 
`define-extended-language` and friends from Redex, except … `redex-match` 
works over terms, not over syntax objects. 

Of course I also can't write

(redex-match LANG NON-TERM (term (syntax->datum S)))

because TERM is a special form, so it doesn't evaluate.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e8c0fa47-1860-48a1-b67a-a586af41e614n%40googlegroups.com.


[racket-users] provide-if-not-defined

2020-09-02 Thread Shriram Krishnamurthi
Related to my previous post [
https://groups.google.com/g/racket-users/c/OqyqDFxwhf0], I have several 
cases where I have this kind of pattern:

V1:

#lang racket
(provide +)

V2:

#lang racket
(provide [rename-out (my-+ +)])
(define my-+ …)

Each variant provides some/all primitives directly from the module's lang, 
while a sibling variant changes their behavior.

Since there are a lot of names, it gets tiresome to remember which things 
have and haven't been exported. Duplicates are of course caught statically, 
but missing names are not "caught" at all at module definition time.

It'd be nice to be able to write, say a block like

#lang racket
(provide-if-not-defined +)

at the top of BOTH files. In V1, this turns into provide; in V2 I'd still 
write the rename-out, but would only need to do this for the (usually) 
small number of operations that I am overriding. Having a common block at 
the top of each variant would ensure that the variants provide the same 
language.

Shriram

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/46a4bed5-1839-4482-b8f2-7b54076fbb7dn%40googlegroups.com.


[racket-users] consistent interfaces from multiple files

2020-09-02 Thread Shriram Krishnamurthi
This may be a somewhat niche request, but hopefully it's just a special 
case of a common need.

I have multiple files, say V1 and V2, that each provide the same surface 
language constructs – e.g., #%app, some macros, some functions — but of 
course implemented in different ways. I also have additional files, say V21 
and V22, that need to extend the common language of V1/2 in a consistent 
way (e.g., add a few more macros and functions that both V21 and V22 
provide).

By default, I can only identify missing things through tests. I would like 
to statically ensure that I have provided the same interfaces, and ideally 
describe the delta between V21/22 and V1/2 (rather than copy the 
description of V1/2 into V21/22).

Essentially, I want to describe the grammar in one place, à la BNF, 
including the names of primitives and such. Note that I want a 
*specification* of the language, separate from its implementation (since 
I'd also like to generate a Web page giving that spec).

There's define-syntax-class for creating new classes for use in a 
syntax-parser. I suppose I could create a rather complex syntax class that 
represents the whole language; presumably I would then apply to this to the 
entire body through module-begin (and to REPL instructions via 
top-interaction)?

Has anyone done something like this and would care to share an example?

Thanks!

Shriram

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/ad36eb34-24a0-4b87-8466-1e01fb1d5396n%40googlegroups.com.


Re: [racket-users] Is this running in DrRacket or as a script?

2020-09-02 Thread Stefan Schmiedl
Title: Re: [racket-users] Is this running in DrRacket or as a script?


Hello Laurent and Sorawee,

this is exactly what I was looking for and it works like a charm.

I never realised that "Submodules to run" was an active UI element.
Probably one of the places where I should have RTExcellentM a bit more.

Thanks a lot,
s.


Wednesday, September 2, 2020, 10:48:32 AM, you wrote:





Using Laurent’s suggestion, you can also create a global variable / parameter that will be set by the drracket submodule. That way, you can create running-in-drracket? and use it inside functions.

On Wed, Sep 2, 2020 at 12:54 AM Laurent  wrote:




You can use a `drracket` submodule:

(module+ drracket
 (foo)
 (bar))

but you need to configure DrRacket to recognize it: Click on the bottom-left button about languages, and at the bottom of "Dynamic Properties", click on "Submodules to run", then "Add submodule option" and add "drracket".

After this, when you run a module from within DrRacket, it will automatically run the `drracket` submodule, but this submodule will *not* be run from the command line (by default).

(I also uncheck the "main" submodule as I use this one only for the command line.)

HTH,
Laurent




On Wed, Sep 2, 2020 at 8:44 AM Stefan Schmiedl  wrote:




Greetings,

I find myself coding some more in DrRacket on my local Win10 PC.
The finished program is to be run on a remote linux server.

I like to keep the code set up for the production environment
but to test it locally I need to configure some things differently.

Currently I'm doing this manually by commenting/uncommenting a sexp
with the required modifications.

Is there a function around that allows me to do something like

(when (running-in-dr-racket?)
  (foo)
  (bar))

Thanks,
s.

--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/26327196.20200902094324%40gmail.com.


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CABNTSaHRMNb8_efegWNC4x68tgo3Q96-ja7ZKHTgSi0Ap86K1g%40mail.gmail.com.







--
Best regards,
Stefan Schmiedl



-- 
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/361439838.20200902135614%40gmail.com.


Re: [racket-users] Is this running in DrRacket or as a script?

2020-09-02 Thread Sorawee Porncharoenwase
Using Laurent’s suggestion, you can also create a global variable /
parameter that will be set by the drracket submodule. That way, you can
create running-in-drracket? and use it inside functions.

On Wed, Sep 2, 2020 at 12:54 AM Laurent  wrote:

> You can use a `drracket` submodule:
>
> (module+ drracket
>  (foo)
>  (bar))
>
> but you need to configure DrRacket to recognize it: Click on the
> bottom-left button about languages, and at the bottom of "Dynamic
> Properties", click on "Submodules to run", then "Add submodule option" and
> add "drracket".
>
> After this, when you run a module from within DrRacket, it will
> automatically run the `drracket` submodule, but this submodule will *not*
> be run from the command line (by default).
>
> (I also uncheck the "main" submodule as I use this one only for the
> command line.)
>
> HTH,
> Laurent
>
>
>
>
> On Wed, Sep 2, 2020 at 8:44 AM Stefan Schmiedl 
> wrote:
>
>> Greetings,
>>
>> I find myself coding some more in DrRacket on my local Win10 PC.
>> The finished program is to be run on a remote linux server.
>>
>> I like to keep the code set up for the production environment
>> but to test it locally I need to configure some things differently.
>>
>> Currently I'm doing this manually by commenting/uncommenting a sexp
>> with the required modifications.
>>
>> Is there a function around that allows me to do something like
>>
>> (when (running-in-dr-racket?)
>>   (foo)
>>   (bar))
>>
>> Thanks,
>> s.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/26327196.20200902094324%40gmail.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CABNTSaHRMNb8_efegWNC4x68tgo3Q96-ja7ZKHTgSi0Ap86K1g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcuegvH7XmiwmB3dHQ-Wec6U73C-4N3DfHYHO1HeOfUYP5peg%40mail.gmail.com.


Re: [racket-users] Is this running in DrRacket or as a script?

2020-09-02 Thread Laurent
You can use a `drracket` submodule:

(module+ drracket
 (foo)
 (bar))

but you need to configure DrRacket to recognize it: Click on the
bottom-left button about languages, and at the bottom of "Dynamic
Properties", click on "Submodules to run", then "Add submodule option" and
add "drracket".

After this, when you run a module from within DrRacket, it will
automatically run the `drracket` submodule, but this submodule will *not*
be run from the command line (by default).

(I also uncheck the "main" submodule as I use this one only for the command
line.)

HTH,
Laurent




On Wed, Sep 2, 2020 at 8:44 AM Stefan Schmiedl 
wrote:

> Greetings,
>
> I find myself coding some more in DrRacket on my local Win10 PC.
> The finished program is to be run on a remote linux server.
>
> I like to keep the code set up for the production environment
> but to test it locally I need to configure some things differently.
>
> Currently I'm doing this manually by commenting/uncommenting a sexp
> with the required modifications.
>
> Is there a function around that allows me to do something like
>
> (when (running-in-dr-racket?)
>   (foo)
>   (bar))
>
> Thanks,
> s.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/26327196.20200902094324%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABNTSaHRMNb8_efegWNC4x68tgo3Q96-ja7ZKHTgSi0Ap86K1g%40mail.gmail.com.


[racket-users] Is this running in DrRacket or as a script?

2020-09-02 Thread Stefan Schmiedl
Greetings,

I find myself coding some more in DrRacket on my local Win10 PC.
The finished program is to be run on a remote linux server.

I like to keep the code set up for the production environment
but to test it locally I need to configure some things differently.

Currently I'm doing this manually by commenting/uncommenting a sexp
with the required modifications.

Is there a function around that allows me to do something like

(when (running-in-dr-racket?)
  (foo)
  (bar))

Thanks,
s.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/26327196.20200902094324%40gmail.com.