From: ···············@gmail.com
Subject: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <1160489350.186543.252550@e3g2000cwe.googlegroups.com>
I'm a student in China. I heard Lisp is a great language and I decide
to learn it this week.
But here are some problems. Would anybody like to give me some help?

1.Where can I find some good tutorials? In China I cannot find any
book, because nobody use it.
2.Where can I find some good tools and codes with comments?
3.I heard that program written by Lisp can change itself in runtime,
really? Is there any untrival examples?

Thanks!

From: Bill Atkins
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <m2wt788aiw.fsf@weedle-24.dynamic.rpi.edu>
···············@gmail.com writes:

> I'm a student in China. I heard Lisp is a great language and I decide
> to learn it this week.
> But here are some problems. Would anybody like to give me some help?
>
> 1.Where can I find some good tutorials? In China I cannot find any
> book, because nobody use it.

http://www.gigamonkeys.com/book

> 2.Where can I find some good tools and codes with comments?
> 3.I heard that program written by Lisp can change itself in runtime,
> really? Is there any untrival examples?

I wonder why newcomers to Lisp focus so much on this aspect of Lisp.
From: Pascal Bourguignon
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <87hcycf1vq.fsf@thalassa.informatimago.com>
Bill Atkins <······@rpi.edu> writes:

> ···············@gmail.com writes:
>
>> I'm a student in China. I heard Lisp is a great language and I decide
>> to learn it this week.
>> But here are some problems. Would anybody like to give me some help?
>>
>> 1.Where can I find some good tutorials? In China I cannot find any
>> book, because nobody use it.
>
> http://www.gigamonkeys.com/book
>
>> 2.Where can I find some good tools and codes with comments?
>> 3.I heard that program written by Lisp can change itself in runtime,
>> really? Is there any untrival examples?
>
> I wonder why newcomers to Lisp focus so much on this aspect of Lisp.

Because introspection is or was considered important for AI.

Actually, that's the raison d'�tre of Von Neuman architecture: storing
the program in the same memory as the data, to allow programs
modifying programs.

In the early times, this was abused, in assembly programming.

Later, there was even micro instructions like the 704 XEC, which would
execute the instruction stored at the address indicated!  (Kind of an
assembly level EVAL). 

Lisp allows to have self modifying programs in a "structured" way.
Instead of modifing random instructions, we can modify whole functions.  


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Indentation! -- I will show you how to indent when I indent your skull!"
From: Frank Buss
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <ebhr7ti7wtmt.1d8mu27j2bs3k$.dlg@40tude.net>
···············@gmail.com wrote:

> 3.I heard that program written by Lisp can change itself in runtime,
> really? Is there any untrival examples?

I think this is a misconception, based on two important features of Lisp:

Most Lisp systems provides an interactive command line, where you can
define functions and test it, so it changes itself at runtime, but only by
user interaction. I don't have an example where a Lisp program changes
itself automaticly at runtime, but you are right, it is possible.

The other feature are macros: Unlike in other languages, Lisp macros are
written in Lisp and produces Lisp code, so a program writes itself, but I
don't know a usecase for expanding macros at runtime, normally macros are
expanded at compile time.

-- 
Frank Buss, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Thomas A. Russ
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <ymislhwytun.fsf@sevak.isi.edu>
Frank Buss <··@frank-buss.de> writes:

> ···············@gmail.com wrote:
> 
> > 3.I heard that program written by Lisp can change itself in runtime,
> > really? Is there any untrival examples?
> 
> I think this is a misconception, based on two important features of Lisp:

I agree that in the general case of a program actually changing its own
code while running, it isn't used very much if at all.  It is a novel
feature, but the engineering ramifications are a bit tough to get a
handle on, so it tends not to be used too much.

I suppose that one could consider some of the genetic algorithm work to
be somewhat like this, although there it is more like an external
program that is doing the mutations on the code and using Lisp's
dynanmic nature to allow execution of the mutated programs.

> Most Lisp systems provides an interactive command line, where you can
> define functions and test it, so it changes itself at runtime, but only by
> user interaction. I don't have an example where a Lisp program changes
> itself automaticly at runtime, but you are right, it is possible.

This may or may not qualify, but the implementation techniques used in
the Loom knowledge representation (KR) language [1] exploited this feature.
The macros for defining the KR objects like concepts and relations also
created the code for executing the queries to retrieve them.  This code
was then compiled and stored, resulting in fast query results, since the
queries for particular relations and concept memberships were
transformed directly into compile Lisp code.  Since it was expected that
such KR definitions would be modified at run-time, and additional
queries were certainly expected at run-time, there was dynamic creation
and modification of the code during operation.

It is certainly a non-trivial example, but it may not be a pure example
of changing the system at run-time.

> The other feature are macros: Unlike in other languages, Lisp macros are
> written in Lisp and produces Lisp code, so a program writes itself, but I
> don't know a usecase for expanding macros at runtime, normally macros are
> expanded at compile time.

Correct.  The only time this doesn't happen is when there is some form
of interaction with a system.


[1] http://www.isi.edu/isd/LOOM/

Disclosure:  I was one of the implementors of Loom.

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Chris Barts
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <pan.2006.10.12.03.49.20.723684@tznvy.pbz>
On Tue, 10 Oct 2006 10:16:16 -0700, Thomas A. Russ wrote:

> I agree that in the general case of a program actually changing its own
> code while running, it isn't used very much if at all.  It is a novel
> feature, but the engineering ramifications are a bit tough to get a
> handle on, so it tends not to be used too much.

It was used a lot more in the past. Self-modifying code could squeeze more
out of a very limited amount of RAM and (possibly) speed things up as
well. Some computers (such as the PDP-1, designed in 1960) had an opcode
that would execute the contents of a memory cell as an opcode (as opposed
to having to branch to that location and then branch back, as in a
subroutine).

Modern programming practice tends to discourage such things.

-- 
My address happens to be com (dot) gmail (at) usenet (plus) chbarts,
wardsback and translated.
It's in my header if you need a spoiler.


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
From: ········@gmail.com
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <1160527870.549925.173920@c28g2000cwb.googlegroups.com>
> 3.I heard that program written by Lisp can change itself in runtime,
> really? Is there any untrival examples?

A common example is a debugger that lets you repair your running code.
Many non-trivial Lisp systems permit this. But I (and others who have
contributed to this thread) don't actually think that this is what you
are talking about because any programming language on a Von Neumann
architecture can do this (it's very common in assembly, for
example).You are probably referrng to the ability of lisp to compute
over its own code AT COMPILE TIME -- i.e., macros -- which is much more
interesting than being able to change itself at run time.
From: Pascal Bourguignon
Subject: Re: Hey! Everybody! Nice to meet you all here!
Date: 
Message-ID: <87d58zg8he.fsf@thalassa.informatimago.com>
···············@gmail.com writes:

> I'm a student in China. I heard Lisp is a great language and I decide
> to learn it this week.
> But here are some problems. Would anybody like to give me some help?
>
> 1.Where can I find some good tutorials? In China I cannot find any
> book, because nobody use it.

http://www.google.com/search?q=lisp+book
http://www.lisp.org/table/books.htm
http://www.apl.jhu.edu/~hall/lisp-books.html

A lot of these books are available on the web.


> 2.Where can I find some good tools and codes with comments?

http://clisp.cons.org/
http://www.common-lisp.net/
http://www.sourceforge.net/ (search for lisp projects)

The CMU AI Repository has a number of (interesting even if somewhat oldish)
sources.
http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/0.html


> 3.I heard that program written by Lisp can change itself in runtime,
> really? 

Yes, really.


> Is there any untrival examples?

I don't have any at hand.  A memoization package would do it.
Otherwise, let's look some AI code

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Indentation! -- I will show you how to indent when I indent your skull!"