[racket] Encapsulation

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Dec 9 17:38:47 EST 2010

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
> 
> 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 processing function that applies make address-book to each item in the list of strings. But how can I refer to them later in the program?
> 
> I thought maybe have the button callback for add/search apply make-address-book to choice-index, this idea worked for adding the name/numbers, but when I try searching it searches empty address-books. Im thinking whats wrong is every application of add creates a new address book and adds the input. Any tips for this problem?
> 
> 
> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.