all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: (n)reverse vs. length
Date: Wed, 14 May 2014 15:10:47 -0400	[thread overview]
Message-ID: <jwvha4stc2u.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <53737B79.7020704@yandex.ru> (Dmitry Antipov's message of "Wed, 14 May 2014 18:19:37 +0400")

> Should (n)reverse has the same semantics as length, i.e. accept
> vectors and strings as well?

Good question.

> IMHO this is the convenient and expected behavior from the point of
> view of the elisp programmer.

Elisp is pretty lame and messy in this respect.
E.g. we have elt/aref/nth which operate on various subsets of sequences.
We have mapc/mapcar which apply to lists and arrays (and strings), but
mapcar returns a list in any case.

I think it would be OK to make `reverse' work on arrays and strings.
I definitely don't want `nreverse' working on strings (strings should
be immutable), but I guess making it work on arrays is fine.


        Stefan



  reply	other threads:[~2014-05-14 19:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 14:19 (n)reverse vs. length Dmitry Antipov
2014-05-14 19:10 ` Stefan Monnier [this message]
2014-05-14 20:12   ` David Kastrup
2014-05-15  1:45     ` Stefan Monnier
2014-05-15  4:29       ` Dmitry Antipov
2014-05-15  5:49         ` David Kastrup
2014-05-15 12:38         ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwvha4stc2u.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.