From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alin Soare Newsgroups: gmane.emacs.devel Subject: Re: Fwd: Tabs for console. Date: Fri, 10 Dec 2010 23:34:06 +0200 Message-ID: References: <54294.130.55.132.100.1292016199.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015174c115038e7bd0497151d0c X-Trace: dough.gmane.org 1292016866 23373 80.91.229.12 (10 Dec 2010 21:34:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 21:34:26 +0000 (UTC) Cc: Stefan Monnier , Emacs Dev To: herring@lanl.gov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 10 22:34:22 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PRAbc-00077F-M4 for ged-emacs-devel@m.gmane.org; Fri, 10 Dec 2010 22:34:21 +0100 Original-Received: from localhost ([127.0.0.1]:49440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRAbb-0001Z2-FS for ged-emacs-devel@m.gmane.org; Fri, 10 Dec 2010 16:34:19 -0500 Original-Received: from [140.186.70.92] (port=54271 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRAbS-0001Xc-48 for emacs-devel@gnu.org; Fri, 10 Dec 2010 16:34:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PRAbQ-0004qe-Oj for emacs-devel@gnu.org; Fri, 10 Dec 2010 16:34:10 -0500 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:60074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PRAbQ-0004q8-Jy for emacs-devel@gnu.org; Fri, 10 Dec 2010 16:34:08 -0500 Original-Received: by wwb17 with SMTP id 17so4141277wwb.30 for ; Fri, 10 Dec 2010 13:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=5eVC9lXoLTGF7DLFped3u7R2DQ4MwCDWbVaJiIGsT2c=; b=l0dZFOyh5fj8eONM35oqy8PZjQX40pT48nI0MwXHUW5n5XAJPt+YsOj0kvlFaeVq6S NEbxw5oAYiHNu+zZepYLdFwNBnchVTEMzAb5oIXh5i+0Is26e+0Mb35+FXtee4NKWLBE MV2qGnt7mXFFpMGFhEFSsS+nVBzcFoEME99pk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=DFz4ivUtEasTJ12563BoH1wKpgoGdcS0lc12ntUeHYt04OTzXpTT/KZib2OztknE06 aXePWGl97QQwudLtwScKaHMgQOMLsmK9wPO2KgBtHrld7gdSNUzJqS2lkSInycpr8QFv TK0odjUdl/4VTCoNx32COG0Ugph/6LtzidfB4= Original-Received: by 10.227.198.203 with SMTP id ep11mr14753wbb.221.1292016847218; Fri, 10 Dec 2010 13:34:07 -0800 (PST) Original-Received: by 10.227.38.162 with HTTP; Fri, 10 Dec 2010 13:34:06 -0800 (PST) In-Reply-To: <54294.130.55.132.100.1292016199.squirrel@webmail.lanl.gov> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133591 Archived-At: --0015174c115038e7bd0497151d0c Content-Type: text/plain; charset=UTF-8 2010/12/10 Davis Herring > > 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 --0015174c115038e7bd0497151d0c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

2010/12/10 Davis Herring <herring@lanl.gov><= br>
> 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)
> =C2=A0 (lambda (m)
> =C2=A0 =C2=A0 (cond ((equal? m ':init)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0(display (string-append x ":init"= ) ) )
> =C2=A0 =C2=A0 =C2=A0 ((equal? m ':activate)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0(display (string-append x ":activate&q= uot;) ) ) ) ) )

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



(defun create-tab (x)
=C2=A0 `(lambda (m)<= br>=C2=A0=C2=A0=C2=A0 (cond ((equal m ':init)
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (message (concat ,x ":init") ) )
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ((equal m ':activate)
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (message (concat ,x ":activate") ) ) ) ) )

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

(funcall tab :init)
<= br>
LOL. It works :).

Alin







--0015174c115038e7bd0497151d0c--