all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: A Soare <alinsoar@voila.fr>
To: Kai Grossjohann <kai@emptydomain.de>
Cc: "Emacs   Help  \[help-gnu-emacs\]" <help-gnu-emacs@gnu.org>
Subject: Re: (list) and '(list)
Date: Fri, 27 Apr 2007 12:37:59 +0200 (CEST)	[thread overview]
Message-ID: <18646321.282181177670279547.JavaMail.www@wwinf4201> (raw)

> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.help as well.
> 
> A Soare <alinsoar@voila.fr> 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.

             reply	other threads:[~2007-04-27 10:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27 10:37 A Soare [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-30 18:53 (list) and '(list) A Soare
2007-04-30 18:15 A Soare
     [not found] <mailman.2557.1177600988.7795.help-gnu-emacs@gnu.org>
2007-04-26 21:55 ` Pascal Bourguignon
2007-04-27  0:58 ` Tim X
2007-04-26 15:17 A Soare
2007-04-27 10:25 ` Kai Grossjohann
     [not found] ` <mailman.2588.1177669955.7795.help-gnu-emacs@gnu.org>
2007-04-27 10:39   ` David Kastrup
2007-04-27 11:05   ` Pascal Bourguignon
2007-04-30 12:49     ` Kai Grossjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18646321.282181177670279547.JavaMail.www@wwinf4201 \
    --to=alinsoar@voila.fr \
    --cc=help-gnu-emacs@gnu.org \
    --cc=kai@emptydomain.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.