[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unexpected result with mapc of lambda form inside catch/throw
From: |
MON KEY |
Subject: |
unexpected result with mapc of lambda form inside catch/throw |
Date: |
Fri, 26 Nov 2010 16:41:21 -0500 |
Can someone please explain why the following expression's `lambda' form returns
32 when mapc'ing its arg X?
I am expecting that X successively evaluate to: 59, 59, and 91
Instead, with the first invocation of the `lambda' form X is 32.
Is this an error? If not, why not?
(emacs-version)
; => "GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-05-10"
emacs -Q
(setq tt--global-var ";;; ")
(let* ((tt--global-var ";;[ ")
(tt--global-var-REAL-DEFAULT ";;; ")
(sub-str-pfx (reverse (cdr (reverse (append tt--global-var nil))))))
;; At this point sub-str-pfx is '(59 59 91)
(unless
(catch 'prefix-not-same
(equal tt--global-var
(concat
(mapc #'(lambda (x)
(when (and (= (car sub-str-pfx) 59)
(= x 32))
(momentary-string-display
(format
(concat
"\nInside lambda form arg X is `mapc'd
over the range (59 59 91)\n"
"At this point X _should be_ %d, but
elisp returns %d, why?")
(car sub-str-pfx) x)
(point)))
(unless (= x (car sub-str-pfx))
(throw 'prefix-not-same
(progn
(momentary-string-display
(format "prefix chars not
identical, failed-at: %S"
(char-to-string x))
(point))
nil)))
sub-str-pfx)
" "))))
(setq tt--global-var tt--global-var-REAL-DEFAULT)
(equal tt--global-var ";;; ")))
--
/s_P\
- unexpected result with mapc of lambda form inside catch/throw,
MON KEY <=