emacs-devel
[Top][All Lists]
Advanced

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

Re: Fwd: Tabs for console.


From: Alin Soare
Subject: Re: Fwd: Tabs for console.
Date: Fri, 10 Dec 2010 23:34:06 +0200



2010/12/10 Davis Herring <address@hidden>
> If, in my loss of knowledge , emacs can make lexical scope, how do you
> re-write this chunk of Scheme code in elisp ?
>
> (define (create-tab x)
>   (lambda (m)
>     (cond ((equal? m ':init)
>        (display (string-append x ":init") ) )
>       ((equal? m ':activate)
>        (display (string-append x ":activate") ) ) ) ) )

In the absence of lexbind, just put ` before the (lambda and , before each x.



(defun create-tab (x)
  `(lambda (m)
    (cond ((equal m ':init)
       (message (concat ,x ":init") ) )
      ((equal m ':activate)
       (message (concat ,x ":activate") ) ) ) ) )

(setq tab (create-tab "xxx"))

(funcall tab :init)


LOL. It works :).

Alin








reply via email to

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