From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Diepenmaat Newsgroups: gmane.emacs.help Subject: Re: newbie questions: why doesn't ((lambda (x) (x 2)) (lambda (n) (+ n 3))) work in elisp? Date: Fri, 30 May 2008 23:33:23 +0200 Organization: Zeekat Softwareonwikkeling Message-ID: <87hccfbhp8.fsf@zeekat.nl> References: <87lk1rbhyo.fsf@zeekat.nl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212183743 24340 80.91.229.12 (30 May 2008 21:42:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 May 2008 21:42:23 +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 May 30 23:43:05 2008 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 1K2CNJ-0001Mb-VN for geh-help-gnu-emacs@m.gmane.org; Fri, 30 May 2008 23:43:02 +0200 Original-Received: from localhost ([127.0.0.1]:59868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2CMY-0001t7-AZ for geh-help-gnu-emacs@m.gmane.org; Fri, 30 May 2008 17:42:14 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!club-internet.fr!feedme-small.clubint.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!transit4.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/23.0.60 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAABgAAAAwBAMAAAD5pqeQAAAAAXNSR0IArs4c6QAAABhQTFRF URgKoyIAmTMXqF5KuYl7y6ui4NDM+/r4zJNdmwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsT AQCanBgAAAAHdElNRQfXDBIUAgGiEa2aAAABYUlEQVQoz02SvXaDMAyF3aHdZegD2PxkJhQ8J4R6 juGUuZDUe43R61eGJA0D8B1dXV0LGCJaDDePyOjZBtT9MgSYbIu+UpNl2A+/ukPXfNUku2ROdWhM 99myqzWX3Czp8dhY1n+MfWau+X4fZGNZpecuSwpFMHOZnpskFppgEaksGs5lFoYeYilOEMkjzcGC CzjxJJoowZIAQMPhfdYEecGhBFCOwO9GKkFkXZDtfIAax2C9wwKAWzwFyPGwQrXCIkimbzAHeFtl Ts0vJHvFkRI01ssVwpyMAoHkGmfFqL+TEmSNXjHMXeiHZAjZqjOsVxxSV8UG3Fi2ZGID2Fs2t7d3 6mLTdIdUM+PuECvW/T6gfobnSqTY+DDgmrnmATSnfMiQrTvcDOikyT1OWHxZPIF8As8P/waOjzdn IGt+vRVgYD7CrakFTSfFbwAB0Y+ghWj0IjP0Scz6I2E3zIlFb/8AfR6DwKVgwNYAAAAASUVORK5C YII= Cancel-Lock: sha1:YTILV4BUoJUCKhDhok0XQxcD/JA= Original-Lines: 29 Original-NNTP-Posting-Host: 80.126.3.69 Original-X-Trace: 1212183203 news.xs4all.nl 14347 [::ffff:80.126.3.69]:39882 Original-X-Complaints-To: abuse@xs4all.nl Original-Xref: news.stanford.edu gnu.emacs.help:159013 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:54377 Archived-At: Joost Diepenmaat writes: > Tahsin Alam writes: > >> As the subject says - why does the following expression give error when I try to evaluate it in the *scratch* buffer? >> >> ((lambda (x) (x 2)) (lambda (n) (+ n 3))) > > Because ((some call evaluating to a function)) isn't valid in emacs > lisp, which also means > > (lambda (x) (x 2)) unless, of course, you've got a (defun x (y) ...) somewhere... > has no real meaning in elisp (it does in scheme, but not in elisp or > common lisp, because elisp and cl have separate namespaces for > functions and variables). You want either > > (funcall (lambda (x) (funcall x 2)) (lambda (n) (+ n 3))) > > or possibly > > (list (lambda (x) (list x 2)) (lambda (n) (+ n 3))) > > or some permutation of both. -- Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/