Re: [racket-users] Messing with 2htdp/image & universe, got a weird problem

2016-04-10 Thread wesley bitomski
I had just remembered that I forgotten the attachment. After further messing about, I figured that 100 cars provided the best balance of ridiculousness and smoothness. Enjoy! -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from

Re: [racket-users] Messing with 2htdp/image & universe, got a weird problem

2016-04-10 Thread wesley bitomski
Thanks for the advice all! I did re-read the code and realized that it's really not all that descriptive. So I tore through it, made better data definitions, commented the code and profiled it (basically seeing how much time it took to execute each statement); and discovered that my simulation

Re: [racket-users] Messing with 2htdp/image & universe, got a weird problem

2016-04-10 Thread Daniel Prager
Hi Wesley Some tips: 1. Your use of random with two args is incorrect: create a (random-range a b) function to express your intent. 2. The slow-down is because you're using unlimited precision arithmetic. Try using 1.0 instead of 1 to get floating point. 3. Instrument your

Re: [racket-users] Racket change button% coordinates(X and Y axis)

2016-04-10 Thread Jens Axel Søgaard
2016-04-10 17:18 GMT+02:00 Theodor Berza : > I have a button in a frame and when I change the vert-margin and > horiz-margin in the code the button doesn't change it's location but rather > the frame gets smaller or larger. > ... > Someone suggested me to create a

Re: [racket-users] Messing with 2htdp/image & universe, got a weird problem

2016-04-10 Thread 'John Clements' via Racket Users
> On Apr 10, 2016, at 8:19 AM, Wesley Bitomski > wrote: > > Attached is some source code I've been playing with. I'm trying to come up > with an approximate simulation of gravity between a very massive (but > inertia-less) mouse cursor and a handful of

[racket-users] Re: Problem with # and mutable lists

2016-04-10 Thread Joan Martin
Sorry, now with attachment. -- 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. For more options, visit

[racket-users] Re: Problem with # and mutable lists

2016-04-10 Thread Joan Martin
Thank you very much, but although I changed else expresion, Racket sometimes returns same warning(but now with #f instead of #). But when I click Run again (sometimes twice or more) it returns what I want. That´s the strangest thing. Could it be an error in Racket settings? I attach my code,

Re: [racket-users] Re: Problem with # and mutable lists

2016-04-10 Thread Gustavo Massaccesi
The most literal translation is #lang racket (define select-room (lambda (number rooms) (let loop ((l (mcar rooms))) (if (not (null? l)) (if (= (mcar(mcar l)) number) (mcar l)

[racket-users] Messing with 2htdp/image & universe, got a weird problem

2016-04-10 Thread Wesley Bitomski
Attached is some source code I've been playing with. I'm trying to come up with an approximate simulation of gravity between a very massive (but inertia-less) mouse cursor and a handful of semi-massless circles. For a test, I'm only simulating a single body. This world program will render the

[racket-users] Racket change button% coordinates(X and Y axis)

2016-04-10 Thread Theodor Berza
I have a button in a frame and when I change the vert-margin and horiz-margin in the code the button doesn't change it's location but rather the frame gets smaller or larger. This is the code: (require racket/gui/base) (define frame (new frame% [label "GUI BUILDER"]

Re: [racket-users] why `read` vs. `read-syntax`?

2016-04-10 Thread Matthew Flatt
At Sun, 10 Apr 2016 07:49:19 -0700, Matthew Butterick wrote: > 1) When, if ever, is the `read` of a #lang invoked by Racket? That happens if you use `read` on a file that starts `#lang`. In that case, the `read-accept-reader` parameter must be set, as in (parameterize ([read-accept-reader #t])

[racket-users] why `read` vs. `read-syntax`?

2016-04-10 Thread Matthew Butterick
The docs describe the relationship this way: "In `read-syntax` mode, the result is always a syntax object ... wrapped around the sort of datum that `read` mode would produce." [1] Along those lines, I've yet to see a #lang where the `read` amounts to more than wrapping `read-syntax` with

[racket-users] Re: Problem with # and mutable lists

2016-04-10 Thread Joan Martin
Thank for your answer, but how should I change the procedure and ged rid of Racket warning? I cant figure it out. -- 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

[racket-users] Re: Problem with # and mutable lists

2016-04-10 Thread Joan Martin
Dne neděle 10. dubna 2016 13:29:43 UTC+2 Joan Martin napsal(a): > Hello, > I try to write a programme (a game), where I use lots of mutable lists (named > environment).Something like this: > (define environment > (mcons (mcons (mcons 1 (mcons (mcons 2(mcons 5(mcons 8 '('() )) >

Re: [racket-users] Problem with # and mutable lists

2016-04-10 Thread Benjamin Greenman
On Sun, Apr 10, 2016 at 7:29 AM, Joan Martin wrote: > I use it without problems : (select-room 2 environment) in this case. > But when I use it in another procedure (for example: set-symbol), > sometimes Racket returns this: > > mcdr: contract violation;;(mcdr in let

Re: [racket-users] Problem with # and mutable lists

2016-04-10 Thread Pierpaolo Bernardi
On Sun, Apr 10, 2016 at 1:29 PM, Joan Martin wrote: > Hello, > I try to write a programme (a game), where I use lots of mutable lists (named > environment).Something like this: > (define environment > (mcons (mcons (mcons 1 (mcons (mcons 2(mcons 5(mcons 8 '('()

[racket-users] Problem with # and mutable lists

2016-04-10 Thread Joan Martin
Hello, I try to write a programme (a game), where I use lots of mutable lists (named environment).Something like this: (define environment (mcons (mcons (mcons 1 (mcons (mcons 2(mcons 5(mcons 8 '('() )) (mcons (mcons 2 (mcons (mcons 1(mcons 3(mcons 10 '( '() ))