[plt-scheme] Another SICP question (graphs and sharing)

From: Gregory Woodhouse (gregory.woodhouse at sbcglobal.net)
Date: Sat Jan 14 21:02:49 EST 2006

On Jan 14, 2006, at 3:56 PM, Matt Jadud wrote:

> SICP isn't so much about learning to program functionally as it is  
> about expanding the way you think about computing. In effect,  
> you're walked through the implementation of several languages and  
> run-times; by the time you're done, you're ready to go out and  
> develop a language, compiler, and hardware for it.
>
> Well, mostly. Kinda. Certainly, if you work through SICP, I expect  
> you'll come out changed as a result of the experience.

Well, I had heard enough about the book that I decided to send order  
it online: it arrived last Monday, and I haven't been able to put it  
down since (well, maybe to watch The National Geographic Channel). In  
fact, after reading "The Little Schemer" and "The Seasoned Schemer",  
I decided I wanted to learn more about this language, but I initially  
passed on SICP, thinking it would be too advanced. In fact, my  
academic background (B.A., M.A.) is in mathematics, so when I picked  
up this book, it really "clicked": Polynomials? symbolic  
differentiation? Those are things I can relate to. I certainly don't  
mean to disparage any of the other books out there, but I am really  
enjoying this one.
>
> If you're looking for a more principled/structured introduction  
> developing software (that happens to be in Scheme), you might work  
> (probably quickly) through HtDP. Then again, perhaps you already  
> looked at it, and decided it was too basic.
>
> http://www.htdp.org/

I thought about ordering both, actually, and will probably come back  
to this one. As it is, there are parts of the language (like call/cc  
and let/cc) that I still find confusing, but I'm not new to  
programming, just Scheme and FP in general.
>
> Personally, I found it to be quite enlightening, and generally have  
> enjoyed teaching with the text. You might find that FFFK discuss  
> the differences between SICP and HtDP, as well as the guiding  
> principles behind HtDP, more eloquently than I have:
>
> http://www.ccs.neu.edu/scheme/pubs/fffk-jfp.pdf

I'll take a look.

>
> As to your questions? I'd say "Is it reasonable?" Maybe. Is there a  
> more functional alternative? Certainly. If you look at the Scheme  
> Cookbook, you'll see that the functional implementations of basic  
> data structures tend to look very much like the structure-derived  
> recipies and templates in HtDP:
>
> http://schemecookbook.org/Cookbook/FunctionalQueue
>
> There aren't any examples, I don't think, of graphs in the  
> Cookbook, but you might be able to extrapolate from the code you  
> see there.
>
> Unfortunately, I'm not able to speak to how the various garbage  
> collectors available to MzScheme deal with sharing. I have my guesses.

I guess the unstated concern on my part is that loops might lead to  
memory leaks. When I started learning Java, the author of the text I  
was reading maybe a real point out of Java using a mark and sweep  
algorithm (to detect unreachable, but allocated, memory locations). I  
know Perl doers reference counting, but I don't know about any other  
languages.
>
> HTH,
> M

===
Gregory Woodhouse
gregory.woodhouse at sbcglobal.net

"Not only is the universe stranger than we
imagine: it is stranger than we can imagine."
--Sir Arthur Eddington




Posted on the users mailing list.