On Feb 15, 2008 2:43 PM, <[EMAIL PROTECTED]> wrote:

> On Fri, Feb 15, 2008 at 02:13:58PM -0800, Mark Schoonover wrote:
> > Well, some of my questions were very generic with Lisp. Meaning, how
> does
> > that code correspond to what's in the text. My biggest hurdle with Lisp
> is
> > program flow. It's not simply top to bottom like Perl is. Even with
> looping,
> > Perl still pretty much reads top to bottom. Lisp looks more like a
> pinball
> > machine at times, with program flow bouncing around within statements.
>
> Yea I know what you mean.  For years recursion bugged me.  What helped me
> finally get comfortable with recursion was tail recursiveness.  Once I
> saw that tail recursive code really *is* just like a Perl style loop it
> seemed
> less alien to me.  YMMV


Well, I thought I understood recursion until SICP.  I think I understand
tail recursion too, and essentially it's converting a procedure where the
last statement is calling itself into an iterative procedure instead of
recursive. My problem is, I don't always see that in the code, but I know
it's very important to Lisp. Any recursive procedure, more than likely will
get written tail recursively. Pretty much if you don't understand this, Lisp
and SICP will be very difficult to understand.

>
>
> > I can't say I'm trying to learn Lisp. I want to understand the concepts,
> but
> > it would be nice to understand how the code matches what's discussed in
> the
> > text.
>
> What specifically don't you see being matched?


Ok, for example take a look at 1.2.2 Tree Recursion. I've entered the
recursive procedure for (fib n). I run it with (fib 5), but my output is
just 5. (I'm using DrScheme) I'm not sure where the 5 even comes from.
Actually, this particular example is more complicated than it initially
looks because there's double recursion going on. In the (else (+ (fib (- n
1)) (fib (- n 2)))) portion, it looks to me the (- n 2) would never be
reached because (fib (- n 1)) is always called first, and it'll bail out
once (= n 1).

Maybe I'm not picturing this correctly in my head, and this could be the
crux of my problem. Running it through the DrScheme debugger doesn't help
much either as I watch the little green arrow bounce around like a pinball
between parens. I guess Larry Wall knew what he was saying when he said lisp
is like a bowlful of oatmeal with nail clippings in it - or something to
that effect.

This is the other problem I'm having getting my brain around Lisp. It simply
looks funny! Not funny haha, but funny weird. It almost looks obfuscated. I
guess I'll get better at it the more I play with it, but for now it leaves
me scratching my head and mumbling to myself.



>
> > I'll keep that in mind when I update the wiki. IIRC, the code is
> available?
>
> http://seberino.org/pyscheme to view code
> http://seberino.org/pyscheme-0.2.tar.gz for tarball.
>
>
I'll keep this handy, I should get time this weekend to update the wiki.

-- 
Mark Schoonover, CMDBA
http://www.linkedin.com/in/markschoonover
http://marksitblog.blogspot.com
[EMAIL PROTECTED]
-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to