unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: Nordlöw <per.nordlow@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Indexing a vector
Date: Wed, 10 Sep 2008 17:57:50 +0200	[thread overview]
Message-ID: <f7ccd24b0809100857v2df06dcdwaaa1aff60e1e6f5c@mail.gmail.com> (raw)
In-Reply-To: <b41b96b6-1b43-49fb-8ded-6c8c1d44f268@x35g2000hsb.googlegroups.com>

On Wed, Sep 10, 2008 at 16:53, Nordlöw <per.nordlow@gmail.com> wrote:

> How do index an element in a vector?

(aref [a b c d] 2)  =>  c

> nth() works only for lists.

Yes, `nth' is a list operation.

> Why on earth isn't such a basic operator compatible with both lists
> and vectors (sequences)?

Because it is a list operation. For the generic sequence operator, try `elt':

  (elt '(a b c d) 2) => c
  (elt [a b c d] 2)  => c
  (elt "abcd" 2) => 99

 Juanma

  parent reply	other threads:[~2008-09-10 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10 14:53 Indexing a vector Nordlöw
2008-09-10 15:53 ` Drew Adams
2008-09-10 15:57 ` Juanma Barranquero [this message]
2008-09-10 16:52 ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0809100857v2df06dcdwaaa1aff60e1e6f5c@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=per.nordlow@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).