From: P.Baxter
Subject: QUESTIONS
Date: 
Message-ID: <6287@merlin.ukc.ac.uk>
OK Lispers, I have a few questions for you.

I am just beginning a study of LISP and comparing it to
another functional language (Miranda) to assess the relative
suitability of each language for the coding of a variety of AI
algorithms, specifically natural language processing and search
algorithms.

I apologise in advance if these questions seem a little banal,
and I thank you for any time you are able to spend providing
your opinions. If you could e-mail me your replies I would be
most grateful.

QUESTION 1 : How useful/important is the capability to make
             assignments to variables in LISP?

             (This is obviously a very general question, I was
             just wondering how much of the time LISP is used
             in a purely functional way).


QUESTION 2 : I keep reading about LISP programs being able to
             re-write themselves as they run.
             How valuable a technique is this? Could you give
             me as simple an example as possible of this in action.


QUESTION 3 : Are any other languages more suitable for teaching AI
             than LISP?


Again I apologise if these questions seem trivial.

LASTLY,  if any of you have solutions in LISP to any of the following
problems handy I'd be most grateful if you could send me copies of
them.

(a) The (classic) 8-queens problem.
(b) The (also classic) knights-tour problem.
(c) Anything to do with natural-language-processing.

Thanks again,

Phil Baxter (···@ukc.ac.uk)

From: Joe Konstan
Subject: Re: QUESTIONS
Date: 
Message-ID: <CBB083.81H@news2.cis.umn.edu>
|> QUESTION 1 : How useful/important is the capability to make
|>              assignments to variables in LISP? 

I agree with Chris Dollin's comment that the greater good lies in being able
to update structures.  Property lists are used regularly in AI applications.

|> QUESTION 2 : I keep reading about LISP programs being able to
|>              re-write themselves as they run. 
|>              How valuable a technique is this? Could you give
|>              me as simple an example as possible of this in action.

One feature I find extremely useful in CLOS is the ability to define 
methods while a program is running.  I have used this extensively to define 
instance methods (i.e., methods that discriminate on value rather than class)
and think that this is one of the better features of CLOS.  One example of
using this is for data propagation and constraints (attaching an after method
to the writer for a slot to propagate the new value.  Another use is to
implement lazy evaluation of formulas.

Joe Konstan
From: Chris Dollin
Subject: Re: QUESTIONS
Date: 
Message-ID: <KERS.93Aug5164109@cdollin.hpl.hp.com>
In article <····@merlin.ukc.ac.uk> ···@ukc.ac.uk (P.Baxter) writes:

[deletia]

   QUESTION 1 : How useful/important is the capability to make
		assignments to variables in LISP? 

I would have said that assignments to *variables* are not very important.
What is important is updates to *structures* -- altering elements of
arrays, the value associated with the key of a hash table, property
entries, car/cdr of lists, etc. Pure functional languages such as
Miranda don't allow this, and it affects code much more than whether
you can rebind variables.

   QUESTION 2 : I keep reading about LISP programs being able to
		re-write themselves as they run. 
		How valuable a technique is this? Could you give
		me as simple an example as possible of this in action.

Although the ability to construct and execute Lisp code from inside
a Lisp program is often cited as one of its Great Powers, I feel that
this is not the right way to thing of it. Regard it instead as giving
you a head start on writing an interpreter for a language specialised
to the task, which just happens to look a lot like Lisp.

[The language, not the task. Yekk.]

High-order procedures give you a lot of power. But then, if you know
Miranda, you know that already.

   QUESTION 3 : Are any other languages more suitable for teaching AI
		than LISP?  

``more'' suitable? Pass. ``As'' suitable? Well, I'd say Pop11, but my
taste here is biased. One should also mention Prolog.

--

Regards,    |   "See the darkness all around              | Renaissance,
Kers.       |   is coming down on you."                   | ``Running Hard''.
From: Lawrence G. Mayka
Subject: Re: QUESTIONS
Date: 
Message-ID: <LGM.93Aug5194005@hermit.flw.att.com>
In article <·················@cdollin.hpl.hp.com> ····@hplb.hpl.hp.com (Chris Dollin) writes:

   In article <····@merlin.ukc.ac.uk> ···@ukc.ac.uk (P.Baxter) writes:

      QUESTION 2 : I keep reading about LISP programs being able to
		   re-write themselves as they run. 
		   How valuable a technique is this? Could you give
		   me as simple an example as possible of this in action.

   Although the ability to construct and execute Lisp code from inside
   a Lisp program is often cited as one of its Great Powers, I feel that
   this is not the right way to thing of it. Regard it instead as giving
   you a head start on writing an interpreter for a language specialised
   to the task, which just happens to look a lot like Lisp.

In Common Lisp, "rewriting oneself" is more commonly known as:

1) Macro expansion.  CL macros are very powerful; they support the
incremental construction of Application Oriented Languages (AOLs) that
are fully integrated with the base language.

2) On-the-fly redefinition.  CL defines the means and behavior of
redefining classes, methods, etc., during program execution.
--
        Lawrence G. Mayka
        AT&T Bell Laboratories
        ···@iexist.att.com

Standard disclaimer.
From: Annick Leroy
Subject: Pb opening a file
Date: 
Message-ID: <23t8dk$j5f@irisa.irisa.fr>
	I am using CMU CL on a sparc. I am trying to add a handler on a file by doing this :
	(setf	fd	(open "/dev/ttyb" 	:direction 	:io	
					:element-type	unsigned-byte))


Error in EVAL:  the variable UNSIGNED-BYTE is unbound.
-> What is the correct syntax ? And what would it be for reading integers ?

	If I open it like this :

	(setf	fd	(open "/dev/ttyb" 	:direction 	:io))

Then adding the handler gives me an error :

	(setf	my-handler	(system:add-fd-handler	fd	:input
				#'(lambda	(fd)
					(print (read-byte	fd))
				)
			)
)

Type-error in COMMON-LISP::MAKE-HANDLER:
   #<Stream for file "/dev/ttyb"> is not of type FIXNUM

		I hope someone can help me, thank you,

						Annick Leroy
From: Timo Gerbes - DA Thomas
Subject: Re: Pb opening a file
Date: 
Message-ID: <1993Aug7.142556@informatik.uni-kl.de>
> I am using CMU CL on a sparc. I am trying to add a handler on a file by 
> doing this :

>	(setf	fd	(open "/dev/ttyb" 	:direction 	:io	
>					:element-type	unsigned-byte))

you must quote the element-type:

	(setf	fd	(open "/dev/ttyb" 	:direction 	:io	
					:element-type	'unsigned-byte))
                                                        ^^^^^^^^^^^^^^^

try also (describe 'open):

>(describe 'open)

OPEN - external symbol in LISP package
-----------------------------------------------------------------------------
OPEN                                                               [Function]

Args: (filename &key (direction :input) (element-type 'string-char)
                     (if-exists :error) (if-does-not-exist :error))
Opens the file specified by FILENAME, which may be a string, a pathname,
or a stream.  Returns a stream for the open file.
Possible DIRECTION values are :INPUT, :OUTPUT, :IO and :PROBE.
Possible ELEMENT-TYPE values are STRING-CHAR, (UNSIGNED-BYTE n),
UNSIGNED-BYTE, (SIGNED-BYTE n), SIGNED-BYTE, CHARACTER, BIT, (MOD n), and
:DEFAULT.
Possible IF-EXISTS values are :ERROR, :NEW-VERSION, :RENAME,
:RENAME-AND-DELETE, :OVERWRITE, :APPEND, :SUPERSEDE, and NIL.
Possible IF-DOES-NOT-EXIST values are :ERROR, :CREATE, and NIL. OPEN


ciao
	timo
From: David Cake
Subject: Re: QUESTIONS
Date: 
Message-ID: <davidc.744879279@kultarr>
In <····@merlin.ukc.ac.uk> ···@ukc.ac.uk (P.Baxter) writes:

>OK Lispers, I have a few questions for you.


>QUESTION 3 : Are any other languages more suitable for teaching AI
>             than LISP?  

Someone mentioned using Pop-11 as being about as useful. Pop-11 is easier to
learn (or at least less intimidating) to people from Pascal/C backgrounds,
IMHO. However I have found the quality of Pop11 textbooks to be not that 
high, at least the two I own (AI programming in Pop11, and some blue book,
sorry, thats all I can remember). It is not that they are that bad, its just 
that they are at an introductory level, and betwen the books and the Poplog
online help, I still couldn't work out a few things. 

>Again I apologise if these questions seem trivial. 

>LASTLY,  if any of you have solutions in LISP to any of the following
>problems handy I'd be most grateful if you could send me copies of
>them. 

>(c) Anything to do with natural-language-processing.
I don't have them handy (I just leant the book out) but there is a book
'Natural Language Processing in Lisp', by Gazdar and Mellish. The same book is
available in Prolog and Pop11 editions anyway. It is a good basic textbook.

>Thanks again,

>Phil Baxter (···@ukc.ac.uk)

					Cheers
						Dave Cake

-- 
David Cake		|life is easily understood as bit strings with logical
[WLM] Weird Little Man	|depth greater than their length - Rebis, Doom Patrol
Cognitive science, UWA	|..think about a government entirely of fish - JBC