all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18555: 24.4.50; butlast and nbutlast doesn't handle improper lists
@ 2014-09-25  4:05 Leo Liu
  2014-09-25  7:21 ` Andreas Schwab
  2019-09-30  2:39 ` Stefan Kangas
  0 siblings, 2 replies; 3+ messages in thread
From: Leo Liu @ 2014-09-25  4:05 UTC (permalink / raw)
  To: 18555


  (nbutlast '(1 2 . 3))

throws an error due to `length' which can be fixed
by using safe-length instead.

  (butlast '(1 2 . 3))

still throws an error due to copy-sequence not taking
improper list.

What is the right thing to do?

Leo





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#18555: 24.4.50; butlast and nbutlast doesn't handle improper lists
  2014-09-25  4:05 bug#18555: 24.4.50; butlast and nbutlast doesn't handle improper lists Leo Liu
@ 2014-09-25  7:21 ` Andreas Schwab
  2019-09-30  2:39 ` Stefan Kangas
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2014-09-25  7:21 UTC (permalink / raw)
  To: Leo Liu; +Cc: 18555

Leo Liu <sdl.web@gmail.com> writes:

>   (nbutlast '(1 2 . 3))
>
> throws an error due to `length' which can be fixed
> by using safe-length instead.
>
>   (butlast '(1 2 . 3))
>
> still throws an error due to copy-sequence not taking
> improper list.
>
> What is the right thing to do?

Don't do that then.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#18555: 24.4.50; butlast and nbutlast doesn't handle improper lists
  2014-09-25  4:05 bug#18555: 24.4.50; butlast and nbutlast doesn't handle improper lists Leo Liu
  2014-09-25  7:21 ` Andreas Schwab
@ 2019-09-30  2:39 ` Stefan Kangas
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2019-09-30  2:39 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 18555, Leo Liu

tags 18555 + notabug wontfix
close 18555
quit

Andreas Schwab <schwab@suse.de> writes:

> Leo Liu <sdl.web@gmail.com> writes:
>
>>   (nbutlast '(1 2 . 3))
>>
>> throws an error due to `length' which can be fixed
>> by using safe-length instead.
>>
>>   (butlast '(1 2 . 3))
>>
>> still throws an error due to copy-sequence not taking
>> improper list.
>>
>> What is the right thing to do?
>
> Don't do that then.

Agreed.  Both butlast and nbutlast are documented to work on lists, and
throwing a malformed list at them should correctly signal an error.

I'm therefore closing this bug report.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-30  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25  4:05 bug#18555: 24.4.50; butlast and nbutlast doesn't handle improper lists Leo Liu
2014-09-25  7:21 ` Andreas Schwab
2019-09-30  2:39 ` Stefan Kangas

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.