[racket] Stuttering problems with big-bang

2013-08-06 Thread Jack Firth
Hey users, I'm experimenting with some simple games using big-bang from 2htdp/universe and I keep running into stuttering problems. It seems to be the garbage collector slowing things down (green recycle symbol in drracket is on whenever the program is frozen). Increasing the memory limit or remov

Re: [racket] Typed Racket and require/typed for polymorphic structs

2013-08-06 Thread Eric Dobson
I'm assuming you mean parametric contracts instead of polymorphic. But not sure why those would be the correct solution, I think any/c would work, I'm not seeing a case where wrapping the value would protect anything. I don't see a fundamental limitation to doing this either. On Tue, Aug 6, 2013

Re: [racket] changing a # value when paused in debug mode

2013-08-06 Thread Edgar Honing
yes, but I was curious about doing that during a debug session. Attempting to set! a procedure to a lambda results in: application: not a procedure; expected a procedure that can be applied to arguments given: '(lambda (x) (..)) arguments...: ... so the 'New value for f' dialog input is interp

Re: [racket] Cleaner way to work with gzipped data?

2013-08-06 Thread JP Verkamp
> I had exactly the same confusion back when I first tried it. Your > example is really helpful. Could it be added to the docs for make-pipe > and/or g(un)zip-through-ports? Go for it. I think that's one of the few problems I tend to have with Racket's documentation is a lack of examples. Functio

Re: [racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Carl Eastlund
That's not a good solution. It works in your current example, but there will be many possible cases where it won't. You're asking the macro system to use whatever is currently bound to the name "dog^" in the context the user wants to bind a name. That won't always be the dog^ interface, if your

Re: [racket] changing a # value when paused in debug mode

2013-08-06 Thread Matthias Felleisen
If this is your code in th edef window: #lang racket (define (f x) x) (set! f f) you can do this in the REPL: Language: racket. > (f 10) 10 > (set! f (lambda (x) (+ (sqrt x) 20))) > (f 10) 23.162277660168378 > On Aug 6, 2013, at 4:03 PM, Edgar Honing wrote: > Hi, > Is it possible to set!

Re: [racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Carl Eastlund
The concept is pretty opaque; syntax object contexts are a fairly tricky, black-magic part of the language. There is a rhyme and reason to them, but it isn't terribly high level or user-friendly. Sadly, no one yet knows how to do better for macros as powerful as Racket's. I've spent a long time

Re: [racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Nick Main
By the way, I found that this also works - applying the lexical context of the dog-unit syntax-object to the dog^ identifier: (define-syntax (use-dog stx) (syntax-case stx () ([_ dog-unit] #`(define-values/invoke-unit dog-unit (import) (export #,(datum->syntax #'dog-un

Re: [racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Nick Main
Many thanks ! The problem makes sense and the solution works. Are there any explanations of "syntax marks" beyond those in the "Syntax Model" section of the documentation ? The concept seems opaque. On Tue, Aug 6, 2013 at 2:32 PM, Carl Eastlund wrote: > Nick, > > The unit system has some non

[racket] Typed Racket and require/typed for polymorphic structs

2013-08-06 Thread Asumu Takikawa
Hi all, Does anyone know why Typed Racket does not support importing polymorphic structs using the #:struct keyword in `require/typed`? Is this a fundamental limitation or just a "small matter of programming"? i.e., I want to do something like (require/typed lang/posn [#:struct posn (A) ([x

Re: [racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Carl Eastlund
Nick, The unit system has some non-hygienic behavior, by design. That is, it introduces names that aren't part of its input, which isn't the default behavior of hygienic macros. Of course we want this -- we want the macro use-dog to bind the names woof and bark, which aren't directly part of its

Re: [racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Jay McCarthy
The problem is that define-values/invoke-unit uses the lexical context of its own syntax to associate the new identifiers with, so the new identifiers aren't in the same context as the 'woof' use. On Tue, Aug 6, 2013 at 3:11 PM, Nick Main wrote: > I am attempting to write a macro to clean up the

[racket] slideshow latex generates poor quality pdf

2013-08-06 Thread Laurent
Hi, When generating pdf with the very useful slideshow-latex, equations have a very poor quality. Has anyone found a solution to this by any chance? Test case (slidetex.rkt): #lang slideshow (require slideshow/latex) (slide ($ "\\sum_{x\\in {\\cal X}} x^2")) Then slideshow --trust --pdf slidet

[racket] define-values/invoke-unit not working when generated by a macro

2013-08-06 Thread Nick Main
I am attempting to write a macro to clean up the use of define-values/invoke-unit and finding some confusing behavior. My macros module is: #lang racket (provide (all-defined-out)) (define-signature dog^ (woof bark)) (define mutt@ (unit (import) (export dog^) (define (woof) (

[racket] changing a # value when paused in debug mode

2013-08-06 Thread Edgar Honing
Hi, Is it possible to set! other values than a string or a number using the set! dialog in DrRacket while in debug mode? For example: I was wondering whether a procedure value can be reassigned to another procedure/lambda. Thanks much, Edgar Racket Users list: http://lists.

Re: [racket] Omitting files when creating a package with raco planet create

2013-08-06 Thread Lawrence Woodman
On 08/06/13 19:07, Jay McCarthy wrote: If you decide to create a Racket package (rather than a Planet package) for your software and host it on Github, then only files you explicitly add to the repository will be included in the package. More details can be found here: http://docs.racket-lang.or

Re: [racket] Omitting files when creating a package with raco planet create

2013-08-06 Thread Lawrence Woodman
On 08/06/13 16:32, Neil Van Dyke wrote: Lawrence Woodman wrote at 08/06/2013 11:15 AM: So I now know what will be in the archives, but is there anyway of restricting what goes into a package? If you use McFly to build your PLaneT archive file, there is a feature for this. The "mcfly-files"

Re: [racket] Cleaner way to work with gzipped data?

2013-08-06 Thread Greg Hendershott
I'll let Ryan comment on dynamic-wind usage. (I'd probably just use with-handlers and raise.) A couple optional thoughts: 1. I notice that with-gzip and with-gunzip are identical except for the function they call. You could parameterize that away: Replace both with a single `with-pipe` function t

Re: [racket] Omitting files when creating a package with raco planet create

2013-08-06 Thread Jay McCarthy
If you decide to create a Racket package (rather than a Planet package) for your software and host it on Github, then only files you explicitly add to the repository will be included in the package. More details can be found here: http://docs.racket-lang.org/pkg/ Jay On Tue, Aug 6, 2013 at 9:15

Re: [racket] Cleaner way to work with gzipped data?

2013-08-06 Thread Greg Hendershott
I had exactly the same confusion back when I first tried it. Your example is really helpful. Could it be added to the docs for make-pipe and/or g(un)zip-through-ports? Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Cleaner way to work with gzipped data?

2013-08-06 Thread JP Verkamp
I've never actually used dynamic-wind, although it does look interesting / like what I need. A few questions / caveats though: - Should the pipe be created in the pre-thunk or before the dynamic-windentirely? The thunks don't seem to share scope, so I'm guessing the latter, but that seems a bit od

Re: [racket] Cleaner way to work with gzipped data?

2013-08-06 Thread Robby Findler
You might consider using dynamic-wind instead of that with-handlers. Or, instead of (error 'with-gunzip ...) just do (raise exn). That way you won't lose the stack information in the original exception (which is likely the one a user would want). Robby On Tue, Aug 6, 2013 at 10:40 AM, JP Verkamp

Re: [racket] Cleaner way to work with gzipped data?

2013-08-06 Thread JP Verkamp
Figured it out and cleaned it up. It turns out that I was using with-handlers oddly, but reading further though the documentation it works as expected. Here's a new version (generalized to any input-port): (define (with-gunzip thunk) (define-values (pipe-from pipe-to) (make-pipe)) (with-handle

Re: [racket] Omitting files when creating a package with raco planet create

2013-08-06 Thread Neil Van Dyke
Lawrence Woodman wrote at 08/06/2013 11:15 AM: So I now know what will be in the archives, but is there anyway of restricting what goes into a package? If you use McFly to build your PLaneT archive file, there is a feature for this. The "mcfly-files" variable that "raco mcfly init" creates i

[racket] Omitting files when creating a package with raco planet create

2013-08-06 Thread Lawrence Woodman
Hello, I'm having problems omitting files when creating packages with: raco planet create . running from the root of the package directory. As you can see from the mess I have made of: http://planet.racket-lang.org/package-source/lwoodman/xdgbasedir.plt/1/0/ Which contains my swap files. I

Re: [racket] (procedure? (hash)) -> true

2013-08-06 Thread John Griffin
Thanks Matthias for the #%app idea. This appears to work exactly as I had wanted such that a hash in function position works with one arg. In the rare case where my application does not want the default #f, I'll just use (hash-ref) in the normal fashions. (module my-racket racket (provide