Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Ryan Culpepper
On 12/09/2010 12:48 PM, Luke Jordan wrote: I will look at for and in-range and spend some more time exploring the built-ins. But I want to talk about the do-times solution, because that was the first thing I tried, but I couldn't make it work. In chapter 11 expression arguments are applied to s

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Joe Marshall
On Thu, Dec 9, 2010 at 11:48 AM, Luke Jordan wrote: >  I don't understand how that applies to > what I'm trying to do here since I'm not building anything, just calling it > over and over and ignoring the result. Right. Timing something is definitely `non-functional' (there is an obvious implici

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Hendrik Boom
On Thu, Dec 09, 2010 at 12:51:12PM -0600, Luke Jordan wrote: > Here's a rookie question that stems from HtDP 29.3.2. > > The idea is to test an expression a number of times while timing it and > compare to another version of the same function. There are practical problems: Timers on computers ar

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Luke Jordan
I will look at for and in-range and spend some more time exploring the built-ins. But I want to talk about the do-times solution, because that was the first thing I tried, but I couldn't make it work. In chapter 11 expression arguments are applied to something that builds up a result (as a list o

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Sam Tobin-Hochstadt
On Thu, Dec 9, 2010 at 2:12 PM, Matthias Felleisen wrote: >> (do ([x 10 (- x 1)]) ((zero? x)) (displayln x)) (for ([x (in-range 10 0 -1)]) (displayln x)) Also, it would be nice if the default `step' value for `in-range' was: (if (<= start end) 1 -1) Then my program would be 3 characters shor

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Matthias Felleisen
Ryan said it all. But since I decided to check on the long-forgotten do loops, I thought I'd show you the one-liner: > (do ([x 10 (- x 1)]) ((zero? x)) (displayln x)) 10 9 8 7 6 5 4 3 2 1 Loops are ugly -- Matthias On Dec 9, 2010, at 1:51 PM, Luke Jordan wrote: > Here's a rookie question

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Ryan Culpepper
On 12/09/2010 11:51 AM, Luke Jordan wrote: Here's a rookie question that stems from HtDP 29.3.2. The idea is to test an expression a number of times while timing it and compare to another version of the same function. The expression finds a route in a vector (graph) from node 0 to node 4. Th

Re: [racket] Rookie Question on Functional Languages

2010-12-09 Thread Stephen Bloch
On Dec 9, 2010, at 1:51 PM, Luke Jordan wrote: > Here's a rookie question that stems from HtDP 29.3.2. > > The idea is to test an expression a number of times while timing it and > compare to another version of the same function. The expression finds a > route in a vector (graph) from node 0