Re: [racket] Encapsulation

2010-12-09 Thread Matthias Felleisen
Your address book is inside the function. Place it outside. (Well that's a hunch of having seen many solutions like that.) -- Matthias On Dec 9, 2010, at 5:33 PM, Ken Hegeland wrote: > I am working on 39.1.8 of HTDP > http://htdp.org/2003-09-26/Book/curriculum-Z-H-49.html#node_sec_39.1 >

[racket] Encapsulation

2010-12-09 Thread Ken Hegeland
I am working on 39.1.8 of HTDP http://htdp.org/2003-09-26/Book/curriculum-Z-H-49.html#node_sec_39.1 I have the gui all set up. The examples in the book use: (define friends (make-address-book "friends")) and then applies friends to the argument, 'add, or 'search. My thought was a basic list proce

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

[racket] Rookie Question on Functional Languages

2010-12-09 Thread Luke Jordan
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. The way I would do this in C/Python is with a whi

Re: [racket] structure question

2010-12-09 Thread Manfred Lotz
On Wed, 8 Dec 2010 16:13:08 -0500 Matthias Felleisen wrote: > > > > Here is a version with 'type' annotations that should be easier to > read and learn from. > > #lang racket > > ;; > - > ;; > library module > >

[racket] ICFP 2011: Call for papers

2010-12-09 Thread Wouter Swierstra
= Call for Papers ICFP 2011: International Conference on Functional Programming Tokyo, Japan, Monday 19 -- Wednesday 21 September 2011 http://www.icfpconference.org/icfp2011 ===