From: MON KEY <monkey@sandpframing.com>
To: emacs-devel@gnu.org
Subject: unexpected result with mapc of lambda form inside catch/throw
Date: Fri, 26 Nov 2010 16:41:21 -0500 [thread overview]
Message-ID: <AANLkTimB07YqHGd6xeWXxvy_uuW_=mOKRzW5tw_ueXq+@mail.gmail.com> (raw)
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\
next reply other threads:[~2010-11-26 21:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-26 21:41 MON KEY [this message]
2010-11-27 15:47 ` unexpected result with mapc of lambda form inside catch/throw Davis Herring
2010-11-27 17:19 ` MON KEY
2010-11-27 18:39 ` Thien-Thi Nguyen
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='AANLkTimB07YqHGd6xeWXxvy_uuW_=mOKRzW5tw_ueXq+@mail.gmail.com' \
--to=monkey@sandpframing.com \
--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.