Re: [racket-users] Strange garbage collection behavior with closures

2015-10-21 Thread Scott Moore
Thanks for the quick response! Now that I’m past that, I see that my problem is probably due to the fact that a weak-hash holds its key strongly. Turns out this is well-documented in the guide, but I missed it since I was reading the reference. I’m curious, is there a particular use case for th

Re: [racket-users] Strange garbage collection behavior with closures

2015-10-21 Thread Matthew Flatt
An empty closure is allocated as a constant --- similar to a literal string or literal fraction in your program. The "closure" will stick around as long as the code does, and the code will stick around as the namespace where its loaded. If you change `(λ () 0`) to `(λ () (if box 0 'huh?))`, then y

[racket-users] Strange garbage collection behavior with closures

2015-10-21 Thread Scott Moore
I’m trying to do something a bit fancy that makes use of weak-hashes, but I’ve run into strange behavior (things not being removed that I believe should be) when I use keys that are closures. Doing some of my own debugging, this doesn’t appear specific to weak hashes, but also to weak boxes. Her

Re: [racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Paolo Giarrusso
On 22 October 2015 at 01:59, Robby Findler wrote: > Just for the record, what Vincent describes below is what DrRacket > does (by default). The problem is that not everyone then hits return a > second time. Thanks, I had never figured! Each programmer editor I know has different amounts of magic

Re: [racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Robby Findler
Just for the record, what Vincent describes below is what DrRacket does (by default). The problem is that not everyone then hits return a second time. Robby On Wed, Oct 21, 2015 at 3:45 PM, Vincent St-Amour wrote: > FWIW, I believe what emacs does (or maybe it's configurable?) is to > delete tra

Re: [racket-users] Re: Probabilities in log-space and rounding errors

2015-10-21 Thread Paolo Giarrusso
On 20 October 2015 at 16:44, Laurent wrote: > Thanks Paolo, yes, I saw that indeed and it is most likely relevant. I was > hoping my problem would be sufficiently more specific; in particular, I'd > like to detect whether the value being above 0 is likely a rounding error > (in which case I can ju

Re: [racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Vincent St-Amour
FWIW, I believe what emacs does (or maybe it's configurable?) is to delete trailing whitespace when a newline is inserted. That way, if you start a new line, it will be indented as it should, and if you press enter again to leave the line blank, that indentation just goes away and you get a true b

Re: [racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Jon Zeppieri
DrWhitespace will certainly remove spaces from empty non-top-level lines. (And from other places, as well.) -J On Wed, Oct 21, 2015 at 4:23 PM, Alexis King wrote: > This might be a relevant thread: > https://groups.google.com/d/msg/racket-users/5pxs1pM-8lE/uh0yn9D0QHYJ > > (It also might not be.

Re: [racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Alexis King
This might be a relevant thread: https://groups.google.com/d/msg/racket-users/5pxs1pM-8lE/uh0yn9D0QHYJ (It also might not be. I’m not really sure if it addresses your issue or not.) > On Oct 21, 2015, at 12:47 PM, Paolo Giarrusso wrote: > > Hi all! > > Every time I reindent a file with DrRacke

Re: [racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Robby Findler
Well, one part of the answer is that DrRacket indents empty lines so when type something like "(define (f x)x" the second "x" is in a reasonable place. Perhaps it could behave differently, but auto-indent-on-return seems less surprising than auto-indent-when-typing-a-character-on-a-whitespace-line.

[racket-users] DrRacket indentation adds spaces to empty non-top-level lines?

2015-10-21 Thread Paolo Giarrusso
Hi all! Every time I reindent a file with DrRacket in a Git repository, DrRacket and Git fight over whitespace. Git assumes that spaces at the end of lines are whitespace errors, while DrRacket indentation will add spaces to empty lines (including existing ones), if they are inside parens (that

[racket-users] Opening .rktd files in DrRacket

2015-10-21 Thread Paolo Giarrusso
Every time I open a .rktd file in DrRacket 6.2.1, I get an error shown, because rktd files don't contain #lang. Googling found nothing, and I didn't find a #lang data. At best, I can add #lang s-exp syntax/module-reader, but those .rktd files won't work unless I change the reading applications.

Re: [racket-users] inconsistency/bug in math/array

2015-10-21 Thread Ryan Culpepper
I think I've run into this problem before. The type of array-slice-ref is (Array A) (Listof Slice-Spec) -> (Array A) where Slice-Spec = (U (Sequenceof Integer) Integer ) The problem is that integers are also sequences, so the contract generated for Slice-Spec just discards the Integer p

Re: [racket-users] Testing environment variable changes

2015-10-21 Thread Jack Firth
On Tuesday, October 20, 2015 at 11:56:33 AM UTC-7, Tim Brown wrote: > I'm not sure if I'd want to be able to arbitrarily change > current-proxy-servers on the fly (something that has proven difficult, > highlighted by the hoops I have to jump through in the tests). On the other > hand it's proba

[racket-users] inconsistency/bug in math/array

2015-10-21 Thread Berthold Bäuml
When using array-slice-ref from math/array I get different results when executing it #lang typed/racket or #lang racket (see below). The typed/racket result is consistent with the documentation, the untyped one seems to be wrong. Berthold #lang typed/racket (require math/array) (define arr