Re: [racket] string problem question

2012-03-19 Thread Stephen Bloch
On Mar 19, 2012, at 3:10 PM, Roelof Wobben wrote: > But the contents of color does not change so I get a error message. > What is the racket way to change the value of a string. That's not the problem. It's your error message, so you should be able to figure out why it's happening. It has noth

Re: [racket] string problem question

2012-03-19 Thread Matthias Felleisen
ps. Your program's light function does NOT map Strings to Images. It maps World to images, ASSUMING you have defined ;; World is ... (probably string here but 1, 2, and 3 would work and so would many others). On Mar 19, 2012, at 4:25 PM, Matthias Felleisen wrote: > > 1. Your program doe

Re: [racket] string problem question

2012-03-19 Thread Matthias Felleisen
1. Your program does NOT change a string. It changes the state of the traffic light (or it tells drracket to keep track of a different state). The string "rood" remains the same in eternity. 2. You're missing test cases, and if you had tested the program you would have discovered it before ev

Re: [racket] Racket style question

2012-03-19 Thread Joe Gilray
Oops... (still learning, Thanks Robby) ... New results run under Racket.exe: (define (pythagorean-triple n) (let loop-ab ([a 1] [b 2]) (define c (- n a b)) (cond [(right-triangle? a b c) (list a b c)] [(>= a (ceiling (/ n 3))) '()] [(<= c b) (loop-ab (add1 a) (+ a 2))

[racket] string problem question

2012-03-19 Thread Roelof Wobben
Hello, I have to make a traffic-light which changes color after each tick of the computer. So I thought this would work : ;; String -> Image ;; given a state of a trafic-light display a circle of the given color if it's a color of the traffic-light otherwise error (define (light color) (c

Re: [racket] DrRacket tabs tip: open files in tabs, not windows

2012-03-19 Thread Laurent
On Mon, Mar 19, 2012 at 14:14, Neil Van Dyke wrote: > If you like to use tabs instead of windows in DrRacket 5.2.1, this is a > very useful preference: > > "Preferences -> General -> Open files in separate tabs (not separate > windows)" > It seems to me that this has been around long before 5.2.

Re: [racket] Racket style question

2012-03-19 Thread Robby Findler
Apologies if this is old news, but if you're running timing tests, be sure to run them in 'racket', from a command-line, not in DrRacket. DrRacket is doing lots of stuff at the same time as running your program that can make measurements significantly less accurate. Robby On Mon, Mar 19, 2012 at

Re: [racket] Racket style question

2012-03-19 Thread Joe Gilray
Hi again Rodolfo, After a some mods, I ran several trials with n = 1 on my ancient laptop and got the following results: (define (pythagorean-triple n) (define a-limit (ceiling (/ n 3))) (let loop-ab ([a 1] [b 2]) (define c (- n a b)) (cond [(right-triangle? a b c) (list a b c)]

Re: [racket] Problem with places and sync/timeout

2012-03-19 Thread Kevin Tew
Fix was committed last Friday. Kevin Racket Users list: http://lists.racket-lang.org/users

[racket] DrRacket tabs tip: open files in tabs, not windows

2012-03-19 Thread Neil Van Dyke
If you like to use tabs instead of windows in DrRacket 5.2.1, this is a very useful preference: "Preferences -> General -> Open files in separate tabs (not separate windows)" Then you can open additional files in tabs by selecting from the pulldown filename widget on the left end of the tool

Re: [racket] Racket style question

2012-03-19 Thread Rodolfo Carvalho
On Mon, Mar 19, 2012 at 04:35, Joe Gilray wrote: > Thanks Rodolfo and Eli for the education, very elegant solutions. > > I really like the clever use of the "(and (right-triangle? a b c) (list a > b c" idiom. > > I had to look up in-value... unfortunately the manual is a bit sparse > there, b

Re: [racket] Racket style question

2012-03-19 Thread Joe Gilray
Thanks Rodolfo and Eli for the education, very elegant solutions. I really like the clever use of the "(and (right-triangle? a b c) (list a b c" idiom. I had to look up in-value... unfortunately the manual is a bit sparse there, but I got the gift by running some examples... thanks. After go