[racket-users] Parallelism / atomic?

2015-06-02 Thread Michael Tiedtke
I'm currently implementing a new parallel objects policy (SAKE: Skip Animation and Skedule) and I'm supposing that setting boolean values (even with an accessor via send) is atomic with respect to its reads. I can't remember where but the documentation (Guide or Reference) somewhere stated that

[racket-users] Removing duplicates from a list while maintaining order

2015-06-02 Thread Paul Bian
Hi all, Trying to learn a bit about recursion in racket. The question is to remove duplicates from a list while maintaining the order of the list. one function to remove duplicates from the left, i.e. 1 2 1 3 2 4 5 -> 1 2 3 4 5 and one from the right. i.e. 1 2 1 3 2 4 5 -> 1 3 2 4 5 I've go

Re: [racket-users] Strange behavior when writing to a file

2015-06-02 Thread Matthew Flatt
If you uncomment the redirects to stdout and comment out the file output, then nothing is written to the file, so that changes the content of `(file->lines soap-file)` the second time around. I think you wanted `(and (>=` in place of `(or (<`. At Tue, 02 Jun 2015 15:25:07 -0400, Mark Lee wrote: >

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Matthew Flatt
The documentation's discussion of drawing in a canvas may be helpful: http://docs.racket-lang.org/gui/canvas___.html There was also a similar thread on this list in January, and the exampe code I posted then may be helpful: http://lists.racket-lang.org/users/archive/2015-January/065764.html

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Matthias Felleisen
I don't understand why you'd want this. But if you do, sleep/yield is the right way to wait for the frame to show up and to send drawing commands. On Jun 2, 2015, at 3:56 PM, John Smith wrote: > Matthias, > > The code you provided worked, but this whole discussion was started to get > the

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Robby Findler
You can override on-paint to draw from a bitmap and then draw into the bitmap. The canvas DC is access directly to the OS-provided drawing context and you add what you need as you see fit. Robby On Tuesday, June 2, 2015, John Smith wrote: > Matthias, > > The code you provided worked, but this

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread John Smith
Matthias, The code you provided worked, but this whole discussion was started to get the code *out* of the body of a function. Is there a way I could run your solution with (send (send canvas get-dc) draw-rectangle 30 20 10 40) running in the top level? -Luke On Tue, Jun 2, 2015 at 3:43 PM, Ma

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread John Smith
Alexander, Pretty strange overall. This code displays nothing: #lang racket (require racket/gui/base) (define frame (new frame% [label "Example"] [width 300] [height 300])) (define canvas (new canvas% [parent frame])) (define dc (send ca

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Matthias Felleisen
You want to override on-paint: #lang racket (require racket/gui/base) (define frame (new frame% [label "Example"] [width 300] [height 300])) (define canvas ;; classes are first-class http://www.ccs.neu.edu/home/matthias/Tmp/Class/programming-with-class/ (new (class

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Alexander D. Knauth
I have never worked with a canvas% before (I have worked with a lot of other racket gui stuff), so I have no idea what’s going on, but watch what happens with this: #lang racket (require racket/gui/base) (define frame (new frame% [label "Example"] [width 300]

[racket-users] Strange behavior when writing to a file

2015-06-02 Thread Mark Lee
To all, I've been recently working on a database and I've encountered strange behavior when I use "call-with-atomic-output-file" and "with-output-to-file". Attached is a sample piece of code. The correct contents of the SOAP file should be : *First-Name : John *Last-Name : Doe *Gender : male *Pho

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread John Smith
Alexis, Thank you for the speedy answer. I think I correctly implemented what you described. See attached. In the new code, no error is thrown but the rectangle is not drawn. Reorderings of displaying the window and drawing the rectangle appear to have no effect. The only way I can get anything to

Re: [racket-users] strange bug with racket/gui

2015-06-02 Thread Alexis King
The problem here is that paint-callback is not called synchronously when you create a new canvas%, so before the callback code runs, the code following the creation of the canvas already attempts to use the drawing context. Since canvas% implements canvas<%>, could you use the get-dc method of

[racket-users] strange bug with racket/gui

2015-06-02 Thread Luke Miles
2 questions. First, when the the attached code is run, `send` throws an error because `dc` still has the value of void. Strangely, if I execute the below line in the REPL after the code has run, the rectangle is successfully displayed. (send dc draw-rectangle 30 20 10 40) Why is `dc` still void

[racket-users] Re: Get list of all predefined identifiers for use in vim syntax highlighting

2015-06-02 Thread Luke Miles
To provide some closure: -The generator provided by Jens completely worked. I set up vim to have one color & indentation for keywords, and another color & indentation for builtins. -The ambiguity brought up by Greg has shown not to be a problem. I only touched racket/base, as I nearly exclusiv

Re: [racket-users] can't quite reproduce this contract error involving an exported function

2015-06-02 Thread Robby Findler
Yes, it is supposed to do that correctly if you have the option turned on. Robby On Mon, Jun 1, 2015 at 3:50 PM, 'John Clements' via users-redirect wrote: > >> On Jun 1, 2015, at 1:46 PM, Robby Findler >> wrote: >> >> I think that if you don't have up to date .zo files, arbitrary badness >> c

Re: [racket-users] Does scribble/lp2 allow for test submodule

2015-06-02 Thread WarGrey Gyoudmon Ju
Yes, you can. I do it all the time. BTW, lp2 is just the lp except that you do not need to wrap it in another scribble file before requiring. On Tue, Jun 2, 2015 at 8:43 PM, Tim Brown wrote: > In the distant past, I tried to use `scribble/lp' with a program with a > `test' sub-module (using tha

Re: [racket-users] Iteration speed

2015-06-02 Thread Matthias Felleisen
On Jun 2, 2015, at 1:20 AM, Matthew Butterick wrote: > I've increasingly been using TR this way (= keeping code in a state where it > can be easily toggled between typechecked and not). It works, though I'm > still thinking about how to achieve better ergonomics with these issues, > which don

[racket-users] Does scribble/lp2 allow for test submodule

2015-06-02 Thread Tim Brown
In the distant past, I tried to use `scribble/lp' with a program with a `test' sub-module (using that common pattern). There was some issue with exporting the module that meant that I could not do it. Now, in 2015, I notice that: a. time has passed, things have developed b. there is a `scribble