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

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

Re: how to add button to emacs that play a elisp code


From: Emanuel Berg
Subject: Re: how to add button to emacs that play a elisp code
Date: Sun, 14 Sep 2014 20:11:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> No. That's the point. I'm using clhs definition of
> same(2), since elisp info doesn't provide a glossary.

(Hint. This message will be more pleasant to read in
Emacs-Lisp mode because of the
`font-lock-constant-face' and
`font-lock-comment-face'.)

;; Here are the ways I know of to determine equality.
;; I didn't include = as that doesn't work on lists
;; (if I had, I might as well have included
;; `string-equal'/`string=').

;; Feel free to provide any additional ways that may
;; exist.

;; When I wrote "same", I did it informally. Even so,
;; I appreciate defining that according to the
;; scientific method.

;; OK:

;; 1. evaluation

(list 1 2 3) ; (1 2 3)
'(1 2 3)     ; (1 2 3)

(setq ll (list 1 2 3))
(setq lq '(1 2 3))

;; 2. eq

(eq ll lq)                     ; nil; but, on the other hand:
(eq (list 1 2 3) (list 1 2 3)) ; nil
(eq '(1 2 3) '(1 2 3))         ; nil

;; 3. eql

(eql ll lq)                     ; nil; but, again:
(eql (list 1 2 3) (list 1 2 3)) ; nil
(eql '(1 2 3) '(1 2 3))         ; nil

;; 4. equal

(equal ll lq)                     ; t
(equal (list 1 2 3) (list 1 2 3)) ; t
(equal '(1 2 3) '(1 2 3))         ; t
(equal (list 1 2 3) '(1 2 3))     ; t

;; Fallout:

;; It is the same according to evaluation. It is not
;; the same according to `eq' and `eql'; on the other
;; hand those don't report the same even for identical
;; data, which humans intuitively consider the same.
;; It is the same according to `equal' (which also
;; report the same for identical data; i.e., is closer
;; than `eq' and `eql' to the way humans think).

;; Conclusion:

;; 1. According to the computer, it is not always the
;;    same, but as often, it is.

;; 2. It is the same when using methods that (in other
;;    cases as well) correspond more closely to the
;;    way humans think.

;; 3. Because I used the word like a human, one would
;;    think I used it correctly because of (2). But,
;;    because I used it in the context of computers,
;;    because of (1), I'll settle for a draw.

;; :)

-- 
underground experts united


reply via email to

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