From: Venkat
Subject: cloning of objects
Date: 
Message-ID: <55442638.0310220215.384353c7@posting.google.com>
is there any facility to clone objects in lisp?
I want to create a new copy of a (value or list or instance)
how can we do

From: Sebastian Stern
Subject: Re: cloning of objects
Date: 
Message-ID: <ad7d32de.0310220718.686cc0c6@posting.google.com>
Venkat wrote:
> is there any facility to clone objects in lisp?
> I want to create a new copy of a (value or list or instance)
> how can we do

If your thinking about Java's clone funcionality, you should know that
a generic clone function is a bad idea. Though perhaps too advanced
for a Lisp newbie, Kent Pitman's article
http://www.nhplace.com/kent/PS/EQUAL.html explains this very well.

Sebastian
"Freedom is the freedom to say (= (+ 2 2) 4). If that is granted, all
else follows."
From: Jason Creighton
Subject: Re: cloning of objects
Date: 
Message-ID: <20031023214704.135bc103.androflux@softhome.net.remove.to.reply>
On 22 Oct 2003 08:18:02 -0700
········@yahoo.com (Sebastian Stern) wrote:

> Sebastian
> "Freedom is the freedom to say (= (+ 2 2) 4). If that is granted, all
> else follows."

Heh, I like the quote, however, I don't think Orwell used Lisp. :)

Jason Creighton
From: Sebastian Stern
Subject: Re: cloning of objects
Date: 
Message-ID: <3f9aa05d$0$448$1b62eedf@news.wanadoo.nl>
"Jason Creighton" wrote:
> > Sebastian
> > "Freedom is the freedom to say (= (+ 2 2) 4). If that is granted, all
> > else follows."
>
> Heh, I like the quote, however, I don't think Orwell used Lisp. :)

Thanks. If you like my quote, you will probably also like "Making an analogy
in the context of George Orwell's 1984: As English is to NewSpeak, so is
Lisp to C" (snipped from the Chris-Perkins' Road To Lisp).

Sebastian
"Freedom is the freedom to say (= (+ 2 2) 4). If that is granted, all
else follows."
From: Espen Vestre
Subject: Re: cloning of objects
Date: 
Message-ID: <kwfzhlo9n0.fsf@merced.netfonds.no>
············@yahoo.com (Venkat) writes:

> is there any facility to clone objects in lisp?

yes, several. Look up all the functions beginning with COPY- in
the spec. COPY-SEQ might be the one you want to look at first, since
it is useful for strings, lists and arrays.
-- 
  (espen)
From: Kenny Tilton
Subject: Re: cloning of objects
Date: 
Message-ID: <NKvlb.22707$pT1.16066@twister.nyc.rr.com>
Venkat wrote:
> is there any facility to clone objects in lisp?
> I want to create a new copy of a (value or list or instance)
> how can we do

There is copy-list, for one.

(defstruct xxx) silently constructs make-xxx and copy-xxx.

I doubt your implementation has a copy-instance for CLOS. You can write 
one, tho, by iterating over the slot names (returned by some 
implementation-dependent MOP call such as class-slots) and using 
SLOT-VALUE to get and set slots.

kenny

-- 
http://tilton-technology.com
What?! You are a newbie and you haven't answered my:
  http://alu.cliki.net/The%20Road%20to%20Lisp%20Survey
From: Henrik Motakef
Subject: Re: cloning of objects
Date: 
Message-ID: <86sml6cy2c.fsf@pokey.internal.henrik-motakef.de>
············@yahoo.com (Venkat) writes:

> is there any facility to clone objects in lisp?

Not a generally useful one, mostly because there is no generally
useful definition of "cloning".

> I want to create a new copy of a (value or list or instance)
> how can we do

There's COPY-LIST, COPY-TREE, COPY-SEQ, COPY-STRUCTURE etc. For
instances, you'll have to roll your own, AFAIK.