From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: A Soare Newsgroups: gmane.emacs.help Subject: Re: (list) and '(list) Date: Fri, 27 Apr 2007 12:37:59 +0200 (CEST) Message-ID: <18646321.282181177670279547.JavaMail.www@wwinf4201> Reply-To: alinsoar@voila.fr NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177670304 5697 80.91.229.12 (27 Apr 2007 10:38:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Apr 2007 10:38:24 +0000 (UTC) Cc: "Emacs Help \[help-gnu-emacs\]" To: Kai Grossjohann Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 27 12:38:22 2007 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 1HhNqI-0000c2-El for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2007 12:38:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhNw7-0000vq-Mu for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Apr 2007 06:44:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HhNvp-0000qL-S7 for help-gnu-emacs@gnu.org; Fri, 27 Apr 2007 06:44:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HhNvo-0000lJ-2s for help-gnu-emacs@gnu.org; Fri, 27 Apr 2007 06:44:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HhNvn-0000kk-Lr for help-gnu-emacs@gnu.org; Fri, 27 Apr 2007 06:44:03 -0400 Original-Received: from smtp3.voila.fr ([193.252.22.173]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HhNpw-0003MC-RP for help-gnu-emacs@gnu.org; Fri, 27 Apr 2007 06:38:01 -0400 Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf4202.voila.fr (SMTP Server) with ESMTP id 8CF711C00084; Fri, 27 Apr 2007 12:37:59 +0200 (CEST) Original-Received: from wwinf4201 (wwinf4201 [10.232.2.28]) by mwinf4202.voila.fr (SMTP Server) with ESMTP id 880EF1C00081; Fri, 27 Apr 2007 12:37:59 +0200 (CEST) X-ME-UUID: 20070427103759557.880EF1C00081@mwinf4202.voila.fr X-Originating-IP: [89.34.170.37] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-CC: |~| X-WUM-REPLYTO: |~| X-detected-kernel: Linux 2.4-2.6 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:43271 Archived-At: > The following message is a courtesy copy of an article > that has been posted to gmane.emacs.help as well. > > A Soare writes: > > > Can somebody tell me if there already is a code that makes the > > distintion between a list that evaluates as a function like > > > > (function ... > > > > and between a list that evaluates to itself : > > > > '(list ... , and its aliases like (quote (list ... etc > > Like the others who responded, it is not clear to me what you want. > > Lisp normally reads code and then evaluates (evals) it. During > reading, it performs some (few) conversions such as 'foo to (quote > foo). During evaluation, the magic happens: > > - If we are looking at a number or a string, return that number or > string. (Numbers and strings are said to be self-evaluating because > they evaluate to themselves.) If we are looking at some special > symbols (like t and nil), return those values. (t and nil are also > self-evaluating.) > > - If we are looking at a list, look at the first element of the list. > If it is a function, then eval all other elements of the list, then > use the results as arguments to the function (call the function). > Then return the result of the function call. > > - The first element can also be a special form. In this case, the > other elements of the list are NOT evaled but instead passed to the > special form verbatim. > > Popular special forms: defun, quote, if, setq > > So in a strict sense, what you can do is: > > (setq unevaled (read STREAM)) > (setq evaled (eval unevaled)) > (equal unevaled evaled) That is what I wanted to know. Giving a string/[part of a buffer] that represents a LISP code, to say if a list inside it defines a function or a symbol (that evaluates to itself). That code solves my problem. Thank you very much. Alin Soare.