From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anselm Helbig Newsgroups: gmane.emacs.help Subject: Re: defun vs lambda Date: Fri, 24 Jul 2009 23:23:09 +0200 Organization: Freie Universitaet Berlin Message-ID: <874ot1ai82.wl%anselm.helbig+news2009@googlemail.com> References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1248471651 15101 80.91.229.12 (24 Jul 2009 21:40:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jul 2009 21:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 24 23:40:44 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MUSVP-0002kr-PW for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Jul 2009 23:40:43 +0200 Original-Received: from localhost ([127.0.0.1]:59469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MUSVP-00033w-6L for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Jul 2009 17:40:43 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-X-Trace: news.uni-berlin.de 8tsZ9tQlfK2NFClKikeG0AwdjZbTsozmKp5mwjqYrNHEIW8FnAwiYrWJiQ Cancel-Lock: sha1:rTgUoxUP+jkCJslXCl/FZjy+6fQ= In-Reply-To: Mail-Followup-To: anselm.helbig+news2009@googlemail.com Original-Xref: news.stanford.edu gnu.emacs.help:171190 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66377 Archived-At: Hi! > I know I can return a function from another function, like this: > > (setq f (lambda () 2)) > > but I have to call it like (funcall f). Is there anyway that I could > do: > > (setf f (defun () 2) and then be able to call (f) ? In emacs lisp, you'd use fset to set the function value of a symbol: (fset 'f (lambda () 2)) (f) See (info "(elisp) Function Cells") for more details. HTH, Anselm -- Anselm Helbig mailto:anselm.helbig+news2009@googlemail.com