HDTenEightyP/NetNews huggingface dataset:
From: secrist@kxovax.enet.dec.com (Strong datatypes for weak minds.)
Newsgroups: comp.lang.lisp.x
Subject: CMU's Full OPS5 by Forgy ?
Date: 1 Oct 92 09:08:20 GMT
Organization: Digital Equipment Corporation


	I have a version of CMU's OPS5 in LISP by Forgy.  The dialect
	is Franz, the code goes on for pages, and you'd have to use a
	C compiler that wasn't bounded by a 64K limitation to build
	XLISP to even come close to running that if that's what people
	are talking about.  

	I have toyed with the idea of making a cut-down version of it
	for years, but never had the time.

	(BTW, anybody got one of the OPS5s for CP/M or MS-DOS that were
	sold many moons ago they'd like to sell me ?  Is there a news
	conference for OPS5 anyplace ?  Dylan ?)

	Regards,
	rcs
Newsgroups: comp.lang.lisp.x
From: dandrews@bilver.uucp (Dave Andrews)
Subject: Re: OPS5 and XLISP (possible?)
Organization: W. J. Vermillion - Winter Park, FL
Date: Wed, 30 Sep 1992 14:30:49 GMT

In article <72887@apple.Apple.COM> dbetz@Apple.COM (David Betz) writes:
>There is a version of OPS5 that works with XLISP posted in the lisp
>conference on BIX.

I did that conversion a few years ago when I was really just learning
Lisp, and knew nothing about OPS5.  The code isn't pretty in spots,
but the changes I made were well flagged.

Unless somebody else has fiddled with it, it ONLY worked under one
of David's "beta" releases of XLISP 2.0 (2.0T5, as I recall).  If you
snag a copy, you will probably have to fiddle with it to some minor
extent to get it running.

It was not a speed demon, but by golly it fired productions.

- David Andrews
  dandrews@bilver.oau.org
From: dbetz@Apple.COM (David Betz)
Newsgroups: comp.lang.lisp.x
Subject: Re: OPS5 and XLISP (possible?)
Date: 29 Sep 92 16:47:43 GMT
Organization: Apple Computer Inc., Cupertino, CA

There is a version of OPS5 that works with XLISP posted in the lisp
conference on BIX.
From: secrist@kxovax.enet.dec.com (Strong datatypes for weak minds.)
Newsgroups: comp.lang.lisp.x
Subject: The OPS5 that works in XLISP
Date: 29 Sep 92 20:27:12 GMT
Organization: Digital Equipment Corporation


	For those of us who are not on BIX, is this code elsewhere
	and/or is it cheap/easy/maintenance free to get onto BIX ?

	What version of XLISP does this code require ?

	Regards,
	rcs

Newsgroups: comp.lang.lisp.x
From: chaiklin@cunixf.cc.columbia.edu (Seth Chaiklin)
Subject: Re: CMU's Full OPS5 by Forgy ?
Reply-To: chaiklin@cunixf.cc.columbia.edu (Seth Chaiklin)
Organization: Columbia University
Date: Thu, 1 Oct 1992 16:09:30 GMT

In article <1843@sousa.ltn.dec.com> secrist@kxovax.enet.dec.com (Strong datatypes for weak minds.) writes:
>
>	I have a version of CMU's OPS5 in LISP by Forgy.  The dialect
>	is Franz, the code goes on for pages, and you'd have to use a
>	C compiler that wasn't bounded by a 64K limitation to build
>	XLISP to even come close to running that if that's what people
>	are talking about.  

Well, I don't know about "people" but that was what I was asking about. (-:
The code from Forgy is about 100K (including comments).  But I believe
the XLISP-PLUS does not have the 64K limit.

You are right about the Franz LISP.  But as i also mentioned, there is
a Common LISP version that was done at CMU.

>	Is there a news conference for OPS5 anyplace ? 

I have tried, without success to find one.

Finally, I have heard that CMU has produced something called Para-OPS
which is supposed to be a "parellel"version.  I believe the source code is C.
Has anyone heard about that?

Cheers,
  Seth
From: chaiklin@cunixf.cc.columbia.edu (Seth Chaiklin)
Newsgroups: comp.lang.lisp.x
Subject: Re: The OPS5 that works in XLISP
Date: 30 Sep 92 12:03:14 GMT
Reply-To: chaiklin@cunixf.cc.columbia.edu (Seth Chaiklin)
Organization: Columbia University

In article <1838@sousa.ltn.dec.com> secrist@kxovax.enet.dec.com (Strong datatypes for weak minds.) writes:
>
>	For those of us who are not on BIX, is this code elsewhere
>	and/or is it cheap/easy/maintenance free to get onto BIX ?

My sentiments exactly. (-:

>	What version of XLISP does this code require ?

Ditto

For what it is worth, I have found TWO different versions of OPS5, one
distributed as part of comp.sources.misc, and the other as part of the
CMU Common Lisp distributioon.  The latter seems more developed/debugged.
And now recently I have heard that CMU distributes a C version of OPS5.

Cheers,
  Seth
Newsgroups: comp.lang.lisp.x
From: troyb@stat.ufl.edu (Troy Bleeker)
Subject: Branch and Bound Algorithm
Organization: University of Fl, Department of Statistics
Distribution: comp.lang.lisp.x
Date: 5 Oct 92 10:28:07

I'm writing a program to solve the traveling salesman problem, and I
would like to use the branch and bound algorithm. I would appreciate it
if someone could send me an outline of the algoritm and/or a description
of it works.

Please post or e-mail responses to 

troyb@stat.ufl.edu

Troy
From: bailey_j@kosmos.wcc.govt.nz
Newsgroups: comp.lang.lisp.x
Subject: Versions of XLISP
Date: 1 Oct 1992 20:51:28 GMT
Organization: Wellington City Council (Public Access), Wgtn, Nz
Distribution: inet
Reply-To: bailey_j@kosmos.wcc.govt.nz
NNTP-Posting-Host: kosmos.wcc.govt.nz

The lastest XLISP I have is 2.1. Are there later versions ? And what is this
XLISP-PLUS I keep hearing about ?
From: kgg@mv.mv.com (Kenn Goutal)
Newsgroups: comp.lang.lisp.x
Subject: Re: Xlisp built in editor?
Date: 6 Oct 92 06:15:16 GMT
Organization: MV Communications, Inc.

In article <1992Oct5.020318.25900@exucom.com> cyberman@exucom.com (Stephen R. Phillips) writes:
>Are thier any editors for Xlisp?
>IE like EMACS? 

Not that I've ever heard of, but according to Appendix B of /The XLISP
Primer/ (by Bonnie Fladung, appendix by DMB his own self) there is, or
at least was, a function (DOS <cmd>), which you could presumably could
use to call your favourite editor on the source file of a function, and
then you could (LOAD ...) it again.  Not terrifically fast or elegant.
I haven't tried the (DOS) function lately, so I don't know if it's still
there.  Also, I have XLISP-PLUS -- dunno how it differs from the original
in this regard.

I'm afraid that the best suggestion I've heard so far is the one that I
happen to use, which is to pop open two windows, one running XLISP and 
one running DOS command line or whatever, and call the editor from the
latter window and then (as above) reload the function from the edited
source file.

>Perhaps an IDE even.

Amen to that, brother.  Hmmm...  Care to write a spec for such a beast?

-- Kenn Goutal
kenn@mv.mv.com
From: secrist@kxovax.enet.dec.com (Strong datatypes for weak minds.)
Newsgroups: comp.lang.lisp.x
Subject: "64K Limit"
Date: 1 Oct 92 19:47:18 GMT
Organization: Digital Equipment Corporation


	The constraints of your C compiler/platofrm are probably the
	first memory constraints you'll run in to, aren't they ?

	Regards,
	rcs
From: toma@sail.LABS.TEK.COM (Tom Almy)
Newsgroups: comp.lang.lisp.x
Subject: New XLISP-PLUS version 2.1e now ready.
Date: 5 Oct 92 14:32:47 GMT
Reply-To: toma@sail.labs.tek.com
Organization: Tektronix, Inc., Beaverton,  OR.

Version 2.1e of the bugfixed and with major extensions (toward
Common Lisp) enhancement of XLISP 2.1 is now available. This version
has contributions from at least nine individuals from the original
code by David Michael Betz. The original XLISP 2.1 is available from
SIMTEL20 and mirror sites, such as wuarchive.

To help differentiate from the "standard" version, I have named the
program XLISP-PLUS. This should help reduce confusion when bugs and
questions are posted on the net.

Compared with version 2.1d, the 80386 compiled version has corrected 
virtual memory code (the old compiled in GO32 had problems),
rational numbers (fixnums and ratios) now overflow into flonums rather
than giving garbage results, and extended ASCII characters are supported
in the PC versions. The UNIX version now supports redirected input and
output. a command line switch allows "batch" execution (errors cause
the program to exit if not caught). There have been several small bug 
fixes as well.

XLISP-PLUS is avaliable from:

glia.biostr.washington.edu	128.95.10.115 (currently /incoming, 
					       will be in /pub/xlisp)
wasp.eng.ufl.edu		128.227.116.1 (/pub)

Look for xlisp21e.zip (for MS-DOS users) or xlisp21e.tar.Z 
(which does not have the PC executable files).

You can also get XLISP-PLUS via my Bitter Butter Better BBS system. A
special account allows accessing the appropriate download area with 
minimum (time) hastle. XLISP-PLUS is divided up among several archive 
files for convenience -- you only need to download what you need.
All the files can be downloaded in about 15 minutes (9600 baud),
or you can select what you need. This will be the most up-to-date resource.

Number: (503)-620-0307
Login: Downloader
Password: Guest
Baud rates: 1200/2400/9600 v.32/v.42b

This system is also on Fidonet (1:105/290), and all Xlisp files can be
FREQed. First FREQ XLISP.TXT for a list of files.

Or you can get XLISP-PLUS via US Mail from me (enclose an IBM PC 5.25" or 
3.5" high density floppy, a stamped self addressed mailer, and a note
stating you want XLISP-PLUS).

Tom Almy
17830 SW Shasta Trail
Tualatin, OR 97062


XLISP-PLUS comes with executables for IBM/PCs and also has an 80386 protected
mode version using DJ Delorie's port of GCC and his GO32 DOS extender. Source 
code, docs, and lisp examples included. Includes UNIX-specific code as well, 
both BSD and SYS V, and for the Amiga, but not Macintosh, etc.

Tom Almy
toma@sail.labs.tek.com
Standard Disclaimers Apply




-- 
Tom Almy
toma@sail.labs.tek.com
Standard Disclaimers Apply
From: cyberman@exucom.com (Stephen R. Phillips)
Newsgroups: comp.lang.lisp.x
Subject: Xlisp built in editor?
Date: 5 Oct 92 02:03:18 GMT
Organization: ExuCom MultiMedia Inc.

Are thier any editors for Xlisp?
IE like EMACS? 
This would make making lisp programs a lot easier for me.

Perhaps an IDE even.
HEck I'll have to hack Xlisp 2.1 code to do that :(
Cyberman
From: chaiklin@cunixf.cc.columbia.edu (Seth Chaiklin)
Newsgroups: comp.lang.lisp.x
Subject: OPS5 and XLISP (possible?)
Date: 29 Sep 92 02:43:21 GMT
Organization: Columbia University



Greetings LISP fans,

I have a copy of XLISP-PLUS running on my PC, and I have a copy of
the production system language called OPS5 as well.  Has anyone
tried to run OPS5 under XLISP?  The first problem that I have encountered
is that OPS5 uses a proclaim functionthat XLISP does not  understand.
I will start to track down a Common Lisp manual and try to
figure it out, but if anyone has already tried this, then I would
appreciate hearing about it.  

Along the same lines, ifanyone knows of similar production system
languages that can run under XLISP, then I would appreciate
knowing about them.

Ultimate interest....to teach some psychology students about cognitive
modeling.

Cheers,
  Seth Chaiklin
From: toma@sail.LABS.TEK.COM (Tom Almy)
Newsgroups: comp.lang.lisp.x
Subject: Re: Xlisp built in editor?
Date: 6 Oct 92 20:34:32 GMT
Reply-To: toma@sail.labs.tek.com
Organization: Tektronix, Inc., Beaverton,  OR.

In article <1992Oct5.020318.25900@exucom.com> cyberman@exucom.com (Stephen R. Phillips) writes:
>Are there any editors for Xlisp?
>IE like EMACS? 

On the PC I use Epsilon (a commercial EMACS clone), and run Xlisp (the 80386
version) in a process window. I wrote my own "Lisp-Mode". It is also possible
to shell out of Xlisp to run an editor. Any decent EMACS like editor should
be possible to hack out a Lisp Mode for indenting, paren matching, etc.



-- 
Tom Almy
toma@sail.labs.tek.com
Standard Disclaimers Apply
Newsgroups: comp.lang.lisp
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.lisp
Subject: Re: Duplicating the output of a serial stream: How?
Date: 5 Oct 1992 14:02:47 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: gandalf.think.com
Keywords: Serial-stream, broadcast-stream,

In article <1992Oct4.183948.5008@cs.cornell.edu> raman@cs.cornell.edu (T. V. Raman) writes:
>But the above does not work and I get an error as follows since the
>broadcast stream will only allow output. How do I write the above so
>that the file-stream gets connected only to the output side of the
>split stream?

Use MAKE-TWO-WAY-STREAM.  The output side of the two-way stream should be
the broadcast stream that you constructed in your original code, and the
input side should be the stream that you're duplicating.

Also, you should use WITH-OPEN-STREAM to open and close these temporary
streams rather than your own UNWIND-PROTECT.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: waander@cs.umd.edu (Bill Andersen)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: lisp for supercomputing
Date: 1 Oct 92 06:42:14 GMT
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742

In article <9209282112.AA01917@cambridge.apple.com> straz@cambridge.apple.com (Steve Strassmann) writes:
>>Date: Mon, 28 Sep 92 20:49:04 +0100
>>From: hmadorf@eso.org (Hans-Martin Adorf)
>>To: info-mcl@cambridge.apple.com
>>
>
>>I know that neither MCL nor Allegor CL are running on the CM5, but
>>the consistent slower performance (two different Fortran compilers,
>>two different CL compilers) of Lisp w.r to Fortran worries me.
>
>It's quite ridiculous to compare Lisp vs. Fortran as implemented
>on Macintoshes and use that to pass judgement on a choice for 
>establishing a policy for supercomputers!
>
>If I were you I'd call Thinking Machines and ask them for benchmark
>statistics comparing their *Lisp vs. their Fortran running on a CM.
>I used to work at TMC (many years ago), and from all I've heard
>recently their *Lisp is quite respectably fast compared with Fortran.


  Quite right, Steve.  However, it's a good idea to point out that
any *Lisp program which hopes to stack up against a Fortran program
for a particular task will be so loaded with declarations, coerce
statements, and such that it ends up looking like C or Fortran code
anyway.  *Lisp isn't exactly what you might expect from Lisp in terms
of simplicity.

  The upside is, however, that you get seemless integration of the
parallel stuff, which you want to run fast, and the rest of lisp,
which you can use for nice interface stuff and other things on the
front end, not to mention the nice development environments Lisp
usually provides.

  At least for the stuff we work on, Lisp on the CM (and the Sun
and the Mac) is the way to go.

  ...bill
-- 
   / Bill Andersen (waander@cs.umd.edu) /
  / University of Maryland             /
 / Department of Computer Science     /
/ College Park, Maryland  20742      /
Newsgroups: comp.lang.lisp.mcl
From: haltraet@monsun.si.no (Hallvard Tr{tteberg)
Subject: pretty-print and macroexpansion
Date: Tue, 29 Sep 1992 00:52:50 GMT
Organization: Center for Industrial Research, Dept. of Knowledge Based Systems

Hi MCLers,

I'm using MCL2.0b1p3 (I have MCL2.0 final, but CLIM doesn't work with
it yet) and have a question concerning pretty-printing and
macroexpansion.

When I use ctrl-m in a buffer, the macroexpansion is printed in the
Listener. But it isn't *pretty-printed* even if *print-pretty* is T. I
have to manually do a (pprint '<cut-paste-the-print-out>). So how can
I make the macroexpanding buffer commands pretty-print its result?
When I think of it, it is more reasonable to pretty-print the
macroexpansion even if *print-pretty* is NIL, instead of not doing it
when it it T.
--
Hallvard Traetteberg
Dept. of Knowledge Based Systems
Center for Industrial Research
Box 124 Blindern, 0314 Oslo 3
NORWAY

Tlf: +47 2 45 29 83 or  +47 2 45 20 10
Fax: +47 2 45 20 40
Email: Hallvard.Tretteberg@si.no
From: wilcox@cmns.think.com
Newsgroups: comp.lang.lisp.mcl
Subject: help balloons for objects
Date: 6 Oct 92 13:25:22 GMT
Original-To: info-mcl@cambridge.apple.com

I have a window that contains several objects. The objects are all drawn by the
window's view-draw-contents function; they are *not* subviews. I would like
to have a separate help balloon for each object, which appears when the mouse
is over that object (similar to how it works for subviews). How can I trick
the code in help-manager.lisp into thinking that each object is a subview?

Incidentally, the reason why the objects are not implemented as subviews is
that they have irregular borders.
Newsgroups: comp.lang.lisp.mcl
From: gat@forsight.jpl.nasa.gov (Erann Gat)
Subject: Re: floating-point compiler
Organization: Jet Propulsion Laboratory
Date: Wed, 30 Sep 1992 17:37:57 GMT

In article <9209291412.AA07979@taarna> taarna!kaveh%comback.UUCP@IRO.UMontreal.CA (Kaveh Kardan) writes:
>
>What exactly does the floating-point compiler on the MCL CD do?  A quick
>look through the code did not make it clear.

I assume you are referring to my FPC program.

FPC compiles floating point expressions down to native 68881 coprocessor
code and packages the resulting code as a lisp function.  The result is
floating point math in Lisp with performance comparable to C.  FPC was
written as an excercise, and thus is not as useful as it could be.  To
make it really useful you'd have to add loops and arrays.  This is
actually not too hard, but it's not the highest thing on my queue.

BTW, has anyone out there actually used FPC under 2.0 final?  Does it
work?  It was developed under MACL 1.3.2 and modified to work with
2.0 beta, but I never had a chance to try it on 2.0 final.

Erann Gat
gat@robotics.jpl.nasa.gov
From: cassels@cambridge.apple.com (Robert A. Cassels)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: help balloons for objects
Date: 6 Oct 92 15:08:11 GMT
Full-Name: Bob Cassels
Original-To: info-mcl@cambridge.apple.com, wilcox@cmns.think.com

>Incidentally, the reason why the objects are not implemented as subviews is
>that they have irregular borders.

So what?

For a good time, see the MCL 2.0 CD:User Contributed Code:Collected
works:Alanr's Contribution:Sheet:Substrate:Shaped-view.lisp
[Presumably also available from the MCL contrib directory.]

From the comments in that file:

A general wdef routine. 
Add four classes of view

shaped-view : A view which has a region method. Stuff in this view is
clipped to the
              region
shrink-wrapped-view: A view which gets its shape from the union of the
shapes of
                     its (shaped) subviews
shaped-window: A window which has a region defining it
shrink-wrapped-window: A window which gets its shapes from it subviews
From: cassels@cambridge.apple.com (Robert A. Cassels)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: pretty-print and macroexpansion
Date: 3 Oct 92 15:19:00 GMT
Full-Name: Bob Cassels
Original-To: info-mcl, haltraet@monsun.si.no (Hallvard Tr{tteberg)

>Hi MCLers,
>
>I'm using MCL2.0b1p3 (I have MCL2.0 final, but CLIM doesn't work with
>it yet) and have a question concerning pretty-printing and
>macroexpansion.
>
>When I use ctrl-m in a buffer, the macroexpansion is printed in the
>Listener. But it isn't *pretty-printed* even if *print-pretty* is T. I
>have to manually do a (pprint '<cut-paste-the-print-out>). So how can
>I make the macroexpanding buffer commands pretty-print its result?
>When I think of it, it is more reasonable to pretty-print the
>macroexpansion even if *print-pretty* is NIL, instead of not doing it
>when it it T.

In 2.0 final, macroexpansions appear to be pretty-printed.
From: danny@farallon.com (Danny Brewer)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: MacTCP Problem
Date: 30 Sep 92 13:57:15 GMT
Followup-To: comp.lang.lisp.mcl
Organization: Farallon Computing, Inc.

In article <1992Sep30.001912.18065@news.media.mit.edu>, asb@media.mit.edu
(Amy Bruckman) wrote:
> 
> (stream-eofp *my-tcp-stream*) always returns nil, even if there's 
> nothing on the stream.  If you call stream-tyi when there's nothing
> on the stream, it just hangs waiting for a character.
> Stream-peek hangs too, since that just calls stream-tyi.

I discovered the same thing some time back.  Using LISTEN seems to
correctly indicate if anything is available in the stream to read.
You can also use READ-CHAR-NO-HANG.  The following code can be used
to communicate line-at-a-time through a tcp stream.  (For example,
to talk to a news server.)

(DEFUN Make-Expandable-String (&OPTIONAL (initial-size 0)
                               &KEY      initial-element
                                         (element-type 'CHARACTER))
  "Make a string that works with VECTOR-PUSH-EXTEND."
  (MAKE-ARRAY initial-size
              :ADJUSTABLE   T
              :FILL-POINTER T
              :INITIAL-ELEMENT initial-element
              :ELEMENT-TYPE element-type
              ))

(DEFUN Skip-Linefeeds (stream)
  (LOOP
    (UNLESS (LISTEN stream)
      (RETURN))
    (IF (CHAR= (PEEK-CHAR NIL stream) #\Linefeed)
      (READ-CHAR-NO-HANG stream)
      (RETURN))))

(DEFUN TCP-Read-Line (tcpStream)
  (WHEN (LISTEN tcpStream)
    (Skip-Linefeeds tcpStream)
    (DO* (
          (str (Make-Expandable-String))
          ch
          )
         ()
      (SETF ch (READ-CHAR-NO-HANG tcpStream))

      (WHEN (NULL ch)
        (RETURN str))

      (WHEN (CHAR= ch #\Newline)
        (Skip-Linefeeds tcpStream)
        (RETURN (VALUES str T)))

      (VECTOR-PUSH-EXTEND ch str))))

(DEFUN TCP-Write-Line (tcpStream str)
  (FORMAT tcpStream "~A~A~A" str #\Newline #\Linefeed)
  (FORCE-OUTPUT tcpStream))


#|
Examples:

(SETF tnews (Open-Tcp-Stream "xxx.com" 119))


(TCP-Read-Line tnews)

(TCP-Write-Line tnews "LIST")

(TCP-Read-Line tnews)

(LET* (line)
  (LOOP
    (SETF line (TCP-Read-Line tnews))
    (UNLESS line
      (RETURN))
    (PRINT line)))

|#

The function TCP-Read-Line returns NIL if there is no line to read.

For a super-duper news reader implementation I thought of (someday)
having a window with a background task that periodically does a
LISTEN and READ-CHAR-NO-HANG to get the next character from the stream.
The entire user interface of the news window would be driven by
characters arriving in the stream, perhaps using a finite automaton.

I've also tried this with MacTCP 1.1.1 and don't seem to have any
problems.  (I'm using MCL 2.0.)

Danny Brewer
danny@farallon.com
From: waander@cs.umd.edu (Bill Andersen)
Newsgroups: comp.lang.lisp.mcl
Subject: Problems with sequence-dialog-items
Date: 6 Oct 92 05:48:06 GMT
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742


  I'm working on an interface tool which displays a list of items
in a sequence dialog item.  I want to be able to click on an item
and have additional info on the item be displayed in the window
containing the sequence-dialog-item.  What I tried was to put an
after method on highlight-table-cell which would do the display.
This works, but it seems to cause the display of the extra info
to be repeatedly refreshed.  There's obviously a loop here caused
by the update to the container window.

  Is there a better way to do this?  Would it simply be better
to define a dialog-item-action method for the table which does
the right thing?

  ...bill

-- 
   / Bill Andersen (waander@cs.umd.edu) /
  / University of Maryland             /
 / Department of Computer Science     /
/ College Park, Maryland  20742      /
From: cfry@MIT.EDU (Christopher Fry)
Newsgroups: comp.lang.lisp.mcl
Subject: Re: Writing Destructive Functions
Date: 30 Sep 92 16:56:19 GMT
Original-To: Ranson <ranson@LANNION.cnet.fr>
Original-Cc: info-mcl@cambridge.apple.com, jbk@world.std.com,
        york@oakland-hills.lucid.com

> Here is a function that has the requested behaviour:
> 
> (defun replace-first (l new)
>   (setf (cdr l) (cons (car l) (cdr l))
>         (car l) new))
> 
> That is, you add a cons cell after the first one, move the first element to
> the second place, and add the new elemnt in its place.
> This may not work if you share other parts of the list too.
>      Daniel.

Interesting you should bring this up. I thought of this solution years ago 
but never actually implemented it. Thanks Daniel.
The cavat here is that l  CANNOT be NIL or the returned result of
the fn will not be EQ to its first arg. Since Lists of NIL are so common, you 
end up having to maintain the list in a var anyway.
Also consider growable vectors. Unlike lists, there can be > 1 empty
vector in a lisp environment.