[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamic and lexical scope, attempted summary with example
From: |
Thien-Thi Nguyen |
Subject: |
Re: dynamic and lexical scope, attempted summary with example |
Date: |
Mon, 21 Jul 2014 06:44:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
() Emanuel Berg <embe8573@student.uu.se>
() Sun, 20 Jul 2014 23:28:58 +0200
(defun shortcut-to-file (key-prefix key file-prefix file)
"Make shortcut with key KEY-PREFIX KEY to FILE-PREFIX FILE."
(global-set-key
(format "%s%s" key-prefix key)
`(lambda ()
(interactive)
(do-show-file (format "%s%s" ,file-prefix ,file)) )))
Is this correct?
It is if it does what the designer desires. :-D
I find ‘(format "%s%s" A B)’ unbeautiful, personally.
2. At the 7th, last line, `file-prefix' and `file'
appears. Those are preceded by commas so, in
combination with the backtick, their values will be
inserted - hard-coded. This bypasses the whole
problem because it eliminates all evaluation of
symbols (it is like Caesar and the Gordian
knot). The drawback is that the lambda can't be
byte-compiled as it is formally "just" a list.
I think using terms "insert" and "hard-coded" is confusing
in this context. Also, "eliminated" is imprecise and thus
misleading. To bake a cake, do you eliminate the flour?
--
Thien-Thi Nguyen
GPG key: 4C807502
(if you're human and you know it)
read my lisp: (responsep (questions 'technical)
(not (via 'mailing-list)))
=> nil
signature.asc
Description: PGP signature
- Lexical and Dynamic Scope, (continued)
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/20
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/21
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/21
- Re: run-with-timer does not display message, Stefan Monnier, 2014/07/24
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/20
- RE: run-with-timer does not display message, Drew Adams, 2014/07/20
- Message not available
- dynamic and lexical scope, attempted summary with example (was: Re: run-with-timer does not display message), Emanuel Berg, 2014/07/20
- Re: dynamic and lexical scope, attempted summary with example,
Thien-Thi Nguyen <=
- Re: dynamic and lexical scope, attempted summary with example, Thorsten Jolitz, 2014/07/21
- Message not available
- Re: dynamic and lexical scope, attempted summary with example, Emanuel Berg, 2014/07/21
- Re: dynamic and lexical scope, attempted summary with example, Michael Heerdegen, 2014/07/21
- Message not available
- Re: dynamic and lexical scope, attempted summary with example, Emanuel Berg, 2014/07/21
- Re: dynamic and lexical scope, attempted summary with example, Thien-Thi Nguyen, 2014/07/21
- Message not available
- Re: dynamic and lexical scope, attempted summary with example, Emanuel Berg, 2014/07/21
- Message not available
- Re: dynamic and lexical scope, attempted summary with example, Emanuel Berg, 2014/07/21
- Message not available
- Re: run-with-timer does not display message, Emanuel Berg, 2014/07/19
Message not available
Re: run-with-timer does not display message, Joost Kremers, 2014/07/15