help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the nth element of a list


From: Barry Margolin
Subject: Re: Setting the nth element of a list
Date: Fri, 05 Jun 2009 16:51:37 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article 
<b775c362-a37c-4d38-bce1-8de6922acbd3@b1g2000vbc.googlegroups.com>,
 Nordlöw <per.nordlow@gmail.com> wrote:

> How do I accomplish the same with arrays? Using aref I guess. Here is
> my mockup that doesn't yet do what I want:
> 
> (defun setnthref (n array x)
>   "Set N:th element of ARRAY to X for side effects only."
>   (set (aref array n) x))

There's already a built-in function aset that does exactly that, except 
it takes its arguments in a different order.  Why do you need your own 
function?

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]