hello, i want to clone a list
From: Ap (marcov8_at_gmail.com)
Date: 02/24/05
- Next message: Wade Humeniuk: "Re: why not enough lisp libraries?"
- Previous message: Paul F. Dietz: "Re: why not enough lisp libraries?"
- Next in thread: Thomas Stenhaug: "Re: hello, i want to clone a list"
- Reply: Thomas Stenhaug: "Re: hello, i want to clone a list"
- Reply: Frode Vatvedt Fjeld: "Re: hello, i want to clone a list"
- Reply: John Thingstad: "Re: hello, i want to clone a list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Feb 2005 05:24:28 -0800
Hello i'm trying to clone i list, so far i have this function
(defun mod-list (lista)
(let ((lista-clone lista))
(list (setf (nth 1 lista) 3) lista lista-clone)))
if i do
(mod-list '(a b c d))
i get
(3 (a 3 c d) (a 3 c d)) <- wrong
(3 (a 3 c d) (a b c d)) <- this is the answer that i want
i understand that if i pass a list as an argument to a function only
the pointer to the memory
location is actually pass. so my question:
1) Is there any way to clone a list inside a function?
One more question
inside a "cond" statement how do i call more than one funcion
for example if i try to do it like this, i get an error:
...(cond ((null list) ((function1) (function2) (function3)))....
what i usually do is
...(cond ((null list) (list (function1) (function2) (function3)))...
but this gives me a lot of unusefull output. my question is:
2) how can i call more than one function in a "cond" statement?
Thanks you very much!!!
please question 1 is very important :)
- Next message: Wade Humeniuk: "Re: why not enough lisp libraries?"
- Previous message: Paul F. Dietz: "Re: why not enough lisp libraries?"
- Next in thread: Thomas Stenhaug: "Re: hello, i want to clone a list"
- Reply: Thomas Stenhaug: "Re: hello, i want to clone a list"
- Reply: Frode Vatvedt Fjeld: "Re: hello, i want to clone a list"
- Reply: John Thingstad: "Re: hello, i want to clone a list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]