From: Andy
Subject: Newbie question: Good code examples ?
Date: 
Message-ID: <3CD2BCD5.AE87233@smi.de>
Hi all
I would like to get a feeling for what is the right style of programming
lisp. Since lisp allows near anything it is still possible to code
programs like in Pascal or C. But i assume thats not what lisp programs
want to be.
So what code(s) would you (as experienced lisp programmers) consider to
be 
good example(s).
It would further be extreme helpful if it was code that deals with
problems
that are not so advanced that i can understand it at all (i.e a good
implementation
of a graph theoretical problem would not really help ;-).

Thanks in advance
AHz

From: Thomas A. Russ
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <ymioffxasak.fsf@sevak.isi.edu>
Some good examples are in Peter Norvig's _Paradigms of AI Programming_
book.  The code is also available on the Web, from the site
   
   http://www.norvig.com/

-- 
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu    
From: Thien-Thi Nguyen
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <kk94rhpds61.fsf@glug.org>
Andy <···@smi.de> writes:

> It would further be extreme helpful if it was code that deals with
> problems that are not so advanced that i can understand it at all (i.e
> a good implementation of a graph theoretical problem would not really
> help ;-).

if you apply these guidelines yourself: it would be helpful if the
question poses constraints in a positive sense not a negative one.
i.e., "what do you understand already?"  how can anyone guess this?

all problems are graph theoretical.  ;->

thi
From: Andy
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <3CD2D9E0.2C7D6BB1@smi.de>
Thien-Thi Nguyen wrote:
> if you apply these guidelines yourself: it would be helpful if the
> question poses constraints in a positive sense not a negative one.
> i.e., "what do you understand already?"  how can anyone guess this?
>
Yes you right. What i want to say is that code is hard to understand if
the problem it will solve needs a lot of specialized backgroud
knowledge.
I would like to learn from code were i understand the problem. Then i
can
thing about how i would solve it and then look into the code. With that
i
see the difference in my solution and that of the author. 
Since my programming stile is strong C oriented i think i will learn a
lot
about lisp with that strategy.
My backgroud is electronic engineering and some years of linux hacking.
So
most areas in electronic or programming would be fine.
> 
> all problems are graph theoretical.  ;->
Realy ? Whats about ULAMs law ;-)
Best regards
AHz
From: Frank A. Adrian
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <0gEA8.4302$FS.91086@news.uswest.net>
Andy wrote:

> I would like to learn from code were i understand the problem. Then i
> can
> thing about how i would solve it and then look into the code. With that
> i
> see the difference in my solution and that of the author.
> Since my programming stile is strong C oriented i think i will learn a
> lot
> about lisp with that strategy.
> My backgroud is electronic engineering and some years of linux hacking.
> So
> most areas in electronic or programming would be fine.

My reccomendations are as follows:

Look at "ANSI Common Lisp" and "On Lisp" by Paul Graham, which give a faily 
good overview of the language features.

When you get somewhat comfortable with the level of code in "ANSI Common 
Lisp", try "Principals of Artificial Intelligence Programing" by Peter 
Norvig.  This book features entire programs many revised in an iterative 
manner.  It is a very enlightening book.

Finally, when you feel like striking out on your own, look at some of the 
public code available out there.  CLOCC has some good stuff, as does the 
CMU AI Repository.

BTW, none of these *really* need to be done in any specific order.  
Sometimes the best way to learn is to jump right in...

faa
From: Kenny Tilton
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <3CD2E30C.90560567@nyc.rr.com>
Andy wrote:
> 
> Hi all
> I would like to get a feeling for what is the right style of programming
> lisp. 

I do not know the answer, but maybe the question should be "What book on
Lisp has the best code examples?" or even "What book on Lisp most
addresses style explicitly?" As a newbie, I for one got a big kick out
of Paul Graham in On Lisp talking about how well-written Lisp should
/appear/. And I do get concerned if my code does not look as he
prescribed.

-- 

 kenny tilton
 clinisys, inc
 ---------------------------------------------------------------
"Harvey has overcome not only time and space but any objections."
                                                        Elwood P. Dowd
From: Peter Seibel
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <m24rhn74l4.fsf@javamonkey.com>
Kenny Tilton <·······@nyc.rr.com> writes:

> Andy wrote:
> > 
> > Hi all
> > I would like to get a feeling for what is the right style of
> > programming lisp.
> 
> I do not know the answer, but maybe the question should be "What
> book on Lisp has the best code examples?" or even "What book on Lisp
> most addresses style explicitly?" As a newbie, I for one got a big
> kick out of Paul Graham in On Lisp talking about how well-written
> Lisp should /appear/. And I do get concerned if my code does not
> look as he prescribed.

As another CL newbie I've been meaning to post a similar question. How
about this: there's a bunch of lisp source available out there on the
net (such as the programs and libraries listed at the ALU web site
[1]. Can anyone recomend any of these, or any other source code
available for download, as being particularly good style, worthy of
emulation? I'm personally particularly interested in seeing a good
large-scale application to see how folks deal with putting together a
big app in Lisp. (That's something you usually don't see in books for
space reasons--I've read both of Graham's books BTW, and loved them.)

-Peter

[1] http://www.alu.org/table/tools.html.


-- 
Peter Seibel
·····@javamonkey.com
From: Wade Humeniuk
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <ab3p2s$2p6$1@news3.cadvision.com>
"Peter Seibel" <·····@javamonkey.com> wrote in message
···················@javamonkey.com...
> As another CL newbie I've been meaning to post a similar question. How
> about this: there's a bunch of lisp source available out there on the
> net (such as the programs and libraries listed at the ALU web site
> [1]. Can anyone recomend any of these, or any other source code
> available for download, as being particularly good style, worthy of
> emulation? I'm personally particularly interested in seeing a good
> large-scale application to see how folks deal with putting together a
> big app in Lisp. (That's something you usually don't see in books for
> space reasons--I've read both of Graham's books BTW, and loved them.)

I have been giving some thought to what constitutes good style and is worthy of emulation.
When it comes to CL it boils down to a few things.

1)  Use the entire CL language.  For example do not do

(setf list (cons element list)) but instead use (push element list).

Do not invent functions that reimplement CL functions.  If are not sure they exist delve
into the CLHS to find the functionality.  Almost always, basic functionality for
manipulating data exists for any situation.

2) Do not limit yourself to one programming style such as CLOS only programming.

3) Use the package system (even if you do not think you need to).

4) USE the condition system.  Learn and apply all the error handling you can.  Error
handling makes programs into great programs.

5) Do not worry about writing your program in a bad style.  Just start writing it.  Write
it at the edges of the problem, at a high level, at a low level, just start anywhere.  The
solution will reveal itself in a very organic way.  Just keep chipping away at it, Lisp
allows one to do this as it does not demand that the whole program be exist before some it
works.  Eventually you will have a program that runs and then you can apply points 1
through 4 to clean it up.  If you need to you can completely rewrite the program (which is
not hard in CL).  But it is very hard to argue with a working program.

I think that programming style is less important than applying the "pattern" of the
problem.

Wade
From: Andy
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <3CD6B544.FE5AE4E6@smi.de>
Hi community,
thanks for the much valuable mails about my request. It makes learning
much easier.

Peter Seibel wrote:
> I'm personally particularly interested in seeing a good
> large-scale application to see how folks deal with putting together a
> big app in Lisp. (That's something you usually don't see in books for
> space reasons--I've read both of Graham's books BTW, and loved them.)
> 
I also have read Paul Grahams ANSI lisp (but i have to read it to get
the
finer pieces) and currently reading Peter Norvigs PAIP. "On Lisp" is on
the
list.
But if you want to look a big peace of code then take a look in the
CMUCL
sources. You will find also a file that describes the concepts. And for
me
it looks like very good lisp (but what do i understand about that ;-).
However, for me it is currently too hard to understand what they are
doing
since i currently have only a worse idea how a lisp compiler works. But
when
i am ready for this i think i will use CMUCL as reference to learn more.
Best regards
AHz
From: Jason Kantz
Subject: Re: Newbie question: Good code examples ?
Date: 
Message-ID: <876624oqo0.fsf@kantz.com>
Well, FAQ's are always a good place to start ...
http://www.faqs.org/faqs/lisp-faq/part1/section-4.html

You might want to browse the Common Lisp Cook Book at
http://cl-cookbook.sourceforge.net/

My personal favorite:
Tutorial on Good Lisp Programming Style
http://norvig.com/luv-slides.ps