Re: updating the last element in a skill list
- From: pxhxz@xxxxxxxxxxx (Pete nospam Zakel)
- Date: 25 Apr 2008 14:25:41 -0800
In article <a31162a4-bde0-4a97-8193-39c81857b07f@xxxxxxxxxxxxxxxxxxxxxxxxxxx> nour <nour.laouini@xxxxxxxxx> writes:
hello,
I have a problem:
I want to update the last element in a skill list by incrementing it ,
for example I have the following list: list='(4 6) and I want to
transform it to this one list='(4 7).
There is a skill fonction which can do it: rplacd(name_liste
new_value) but it works only when I give the exact new_value, for
example i must tape
rplacd( list '(7))
Please help me because i must use it in a "for" fonction so the
incrementation must happen automatically ....
I've tried this but it didn't work:
y=nth( 1 list)+1
rplacd( list '(y))
it generate the following list: (4 y)
thanks a lot for the one who will help me
It's replacing the last element with the symbol y because that's what you
are telling it to do. The single quote in front of the open paren says
"don't evaluate symbols, pass them as is".
if you do:
y = nth( 1 list )+1
rplacd( list list(y) )
it will do what you are asking for, since the list function evaluates its
arguments.
The following will also work:
y = list( nth( 1 list )+1 )
rplacd( list y )
Your statement:
rplacd( list '(y) )
is equivalent to:
rplacd( list list( 'y ) )
-Pete Zakel
(phz@xxxxxxxxxxxxxxxx)
Felson's Law:
To steal ideas from one person is plagiarism; to steal from
many is research.
.
- Follow-Ups:
- Re: updating the last element in a skill list
- From: Pete nospam Zakel
- Re: updating the last element in a skill list
- References:
- updating the last element in a skill list
- From: nour
- updating the last element in a skill list
- Prev by Date: Re: Fatal error: Illegal library definition found in netlist
- Next by Date: Re: updating the last element in a skill list
- Previous by thread: Re: updating the last element in a skill list
- Next by thread: Re: updating the last element in a skill list
- Index(es):
Relevant Pages
|
|