Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion identity function with an echo side effect

Path: g2news1.google.com!postnews.google.com!j8g2000yqd.googlegroups.com!not-for-mail
From: bolega <gnuist...@gmail.com>
Newsgroups: gnu.emacs.help,comp.emacs,comp.emacs.xemacs,gnu.emacs,comp.lang.lisp
Subject: Re: identity function with an echo side effect
Date: Wed, 11 Aug 2010 10:42:43 -0700 (PDT)
Organization: http://groups.google.com
Lines: 107
Message-ID: <106a3bf2-cd32-4b50-8e99-81e0cad8efa2@j8g2000yqd.googlegroups.com>
References: <324e9d4c-b083-42a3-aa88-4e7b918042e3@h32g2000yqm.googlegroups.com> 
	<87eie6ax5b.fsf@kuiper.lan.informatimago.com> <a4edac8f-c73e-468a-ac22-9436a40e07bb@c10g2000yqi.googlegroups.com> 
	<87ocd99qps.fsf@kuiper.lan.informatimago.com>
NNTP-Posting-Host: 75.28.99.50
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1281548563 26639 127.0.0.1 (11 Aug 2010 17:42:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 11 Aug 2010 17:42:43 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: j8g2000yqd.googlegroups.com; posting-host=75.28.99.50; 
	posting-account=REkl4woAAABFXaU7nL79XtGpnmNCQ415
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) 
	Gecko/20100115 Firefox/3.6,gzip(gfe)

On Aug 11, 7:19=A0am, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> bolega <gnuist...@gmail.com> writes:
> > On Aug 10, 4:03=A0pm, p...@informatimago.com (Pascal J. Bourguignon)
> > wrote:
> >> bolega <gnuist...@gmail.com> writes:
> >> > After searching google groups and emacs apropos extensively, I could
> >> > not find a function, perhaps I am missing one that can return
> >> > identically return its argument and has a small side effect of echoi=
ng
> >> > the argument in some place such as for example
>
> >> > the mini buffer or the point at which C-x C-e is typed.
>
> >> > For example, calling this function "echo" , usage would look like
> >> > this :
>
> >> > (cdr ( echo (cdr (echo (cdr (echo '(a b c d)))))))
>
> >> > echo:
> >> > '(a b c d) or (a b c d) =A0(I am not sure which would be appropriate=
)
> >> > (b c d)
> >> > (c d)
>
> >> > result:
> >> > (d)
>
> >> > Is there a need for quotes to prevent evaluation of alphabets at any
> >> > phase ?
>
> No. =A0Expressions are evaluated only by EVAL or LOAD (and at
> compilation time, compilation time expressions by COMPILE and
> COMPILE-FILE). =A0Otherwise, values are just values, they don't get
> evaluated magically (for what reason should they?)
>
> >> In Common Lisp, you can use PRINT for this.
>
> >> CL-USER> (cdr (print (cdr (print (cdr (print '(a b c d)))))))
>
> >> (A B C D)
> >> (B C D)
> >> (C D)
> >> (D)
> >> CL-USER>
> >> [...]
>
> > If you dont mind, how many years have you spent on learning emacs/
> > lisp ?
>
> 20 years.
>
> > Can you kindly give a reading syllabus, books list and possibly time
> > for completion from your perspective and what to get out of each book
> > since they have some common repetition.
>
> http://www.cliki.net/admin/search?words=3Dbooks
>
> In particular, I like to advise:
>
> =A0Common Lisp: A Gentle Introduction to Symbolic Computation
> =A0http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/user/dst/www/LispBook/index..=
..
> =A0http://www.cs.cmu.edu/~dst/LispBook/
>
> > Are there any implicit quotations taking place in the above sequence
> > of cdr, print ... ?
>
> Since CDR and PRINT are function, no implicit quotation occurs: the
> result values are directly passed as argument to the next function.

Then why does the following gives an error. Currently, I only have
elisp working so we confine to emacs runs.

(cdr (print (cdr (print (cdr (print (a b c d)))))))    C-x C-e

gives this error if I remove the quote. why ? I get errors if I remove
all prints. This means if the first cdr required quoted list, then the
rest must also require it. Hence, an implicit quotation might be
occurring as in setq ? Also, plz explain me the debugger output in
detail so I can figure it out myself. may be a line by line comment
and if there is a more comprehensive example you can cook, better for
all the readers, once and for all.

Debugger entered--Lisp error: (void-function a)
  (a b c d)
  (print (a b c d))
  (cdr (print (a b c d)))
  (print (cdr (print ...)))
  (cdr (print (cdr ...)))
  (print (cdr (print ...)))
  (cdr (print (cdr ...)))
  eval((cdr (print (cdr ...))))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
* call-interactively(eval-last-sexp)



>
> Only macros receive their arguments un-evaluated, which could be
> characterized as an "implicit quotation".
>
> --
> __Pascal Bourguignon__ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0http://www.=
informatimago.com/