[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 2016-05-23 Emacs News
From: |
Rolf Ade |
Subject: |
Re: 2016-05-23 Emacs News |
Date: |
Fri, 10 Jun 2016 02:04:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Sacha Chua <address@hidden> writes:
> 2016-05-23 Emacs News
>
> * Coding:
>
> * Literal values and destructive functions
(That is:
http://mbork.pl/2016-05-23_Literal_values_and_destructive_functions)
Wait, what?
Sure, sort is documented as modifying the LIST in place. And the setq
makes `foo` global, so ... maybe no surprise, or so. But if I eval
(defun destructive-havoc ()
"Example of destructive havoc."
(let ((foo '(1 3 2)))
(message "before sort, foo is: %s" foo)
(sort foo #'<)
(message "after sort, foo is: %s" foo)))
and M-: (destructive-havoc) two times, I still get
before sort, foo is: (1 3 2)
after sort, foo is: (1 2 3)
before sort, foo is: (1 2 3)
after sort, foo is: (1 2 3)
in *Messages*. Could someone please explain that to me?
- Re: 2016-05-23 Emacs News,
Rolf Ade <=