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
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Pascal J. Bourguignon  
View profile  
 More options Aug 10 2010, 7:03 pm
Newsgroups: gnu.emacs.help, comp.emacs, comp.emacs.xemacs, gnu.emacs, comp.lang.lisp
From: p...@informatimago.com (Pascal J. Bourguignon)
Date: Wed, 11 Aug 2010 01:03:12 +0200
Local: Tues, Aug 10 2010 7:03 pm
Subject: Re: identity function with an echo side effect

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 echoing
> 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)  (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 ?

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>

In emacs lisp too, but the output of print goes to the *Message* buffer.

M-x ielm RET
ELISP> (cdr (print (cdr (print (cdr (print '(a b c d)))))))
(d)

and you get:

(a b c d)

(b c d)

(c d)

in the minibuffer and in *Message*.

Or, in an emacs lisp buffer:

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

inserts:

(a b c d)

(b c d)

(c d)
(d)

--
__Pascal Bourguignon__                     http://www.informatimago.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.