From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ed L Cashin Newsgroups: gmane.emacs.help Subject: Re: 'let' for functions ? Date: Sat, 26 Apr 2003 15:19:41 -0400 Organization: negia.net Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87ptn912ya.fsf@cs.uga.edu> References: <1036073066.48586.0@iris.uk.clara.net> <87vg3i4rq2.fsf@lynx.ionific.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1051384837 21297 80.91.224.249 (26 Apr 2003 19:20:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 26 Apr 2003 19:20:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 26 21:20:34 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 199VDu-0005X8-00 for ; Sat, 26 Apr 2003 21:20:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 199VED-00013h-02 for gnu-help-gnu-emacs@m.gmane.org; Sat, 26 Apr 2003 15:20:53 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (i386-debian-linux-gnu) Cancel-Lock: sha1:yJHvraFaBaTRBUKOLbneLiRUy+Y= Cache-Post-Path: alpha.negia.net!unknown@ppp63-172-85-115.silverstreakdsl.com X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Original-X-Complaints-To: abuse@supernews.com Original-Lines: 34 Original-Xref: shelby.stanford.edu gnu.emacs.help:112381 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8879 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8879 Hannu Koivisto writes: > chris@example.org writes: > >> I just wondered if it is possible to get the lexical scoping effect for >> functions that 'let' and related functions provide for variables. > > Note that Emacs Lisp is dynamically scoped, thus let does not > provide lexical scoping but dynamic scoping. > >> i.e I want to be able to do something like this : >> >> (let ((funca funcb)) >> (require 'foolib)) > > You can use flet (or labels if you need recursion) from the cl > package: > > (require 'cl) > > (flet ((funca (&rest args) > (apply 'funcb args))) > (require 'foolib)) As an exercise I tried in vain to create a simple implementation of labels that wouldn't require loading cl. I couldn't do it, though, and had to get on with what I was supposed to be doing. ;) I'd be very interested, though, to see such a simple implementation of labels if there's an elisp guru who would enjoy trying to find it. The hard part for me was recursion support. -- --Ed L Cashin PGP public key: http://noserose.net/e/pgp/