all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* List Seperator
@ 2003-04-07 20:27 Artist
  2003-04-07 20:52 ` Johan Bockgård
  0 siblings, 1 reply; 7+ messages in thread
From: Artist @ 2003-04-07 20:27 UTC (permalink / raw)


Hi,
 I am trying to learn new function  and when I try to use the function
with M-1 C-x C-e it returns the list in form of a long list space
seperated. I like to have it returned as new line seperated. How I can
achive that?

Thanks,
Artist

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: List Seperator
  2003-04-07 20:27 List Seperator Artist
@ 2003-04-07 20:52 ` Johan Bockgård
  2003-04-09  4:22   ` Artist
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Bockgård @ 2003-04-07 20:52 UTC (permalink / raw)


googleartist@yahoo.com (Artist) writes:

>  I am trying to learn new function  and when I try to use the function
> with M-1 C-x C-e it returns the list in form of a long list space
> seperated. I like to have it returned as new line seperated. How I can
> achive that?

Does pp-eval-last-sexp do what you want?
,----
| Run `pp-eval-expression' on sexp before point (which see).
| With argument, pretty-print output into current buffer.
`----

-- 
What did you expect? The average Elisp hacker is so cool that he is in
no need of a table/desktop, placing his laptop where the name
indicates it belongs. But the precarious balance of the same is often
in need of structural support. -- DK about http://www.emacslisp.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: List Seperator
  2003-04-07 20:52 ` Johan Bockgård
@ 2003-04-09  4:22   ` Artist
  2003-04-09  4:53     ` LISP: Very Very Basic Question Gurucharan
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Artist @ 2003-04-09  4:22 UTC (permalink / raw)


bojohan+news@dd.chalmers.se (Johan Bockgård) wrote in message news:<yoijfzoukp34.fsf@helm.dd.chalmers.se>...
> googleartist@yahoo.com (Artist) writes:
> 
> >  I am trying to learn new function  and when I try to use the function
> > with M-1 C-x C-e it returns the list in form of a long list space
> > seperated. I like to have it returned as new line seperated. How I can
> > achive that?
> 
> Does pp-eval-last-sexp do what you want?
> ,----
> | Run `pp-eval-expression' on sexp before point (which see).
> | With argument, pretty-print output into current buffer.
> `----
It just puts the result in another buffer. and doesn't seperate by new line.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* LISP: Very Very Basic Question.
  2003-04-09  4:22   ` Artist
@ 2003-04-09  4:53     ` Gurucharan
       [not found]     ` <mailman.4322.1049863665.21513.help-gnu-emacs@gnu.org>
  2003-04-09 15:04     ` List Seperator Johan Bockgård
  2 siblings, 0 replies; 7+ messages in thread
From: Gurucharan @ 2003-04-09  4:53 UTC (permalink / raw)
  Cc: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]

Hello All,

       Can anyone explain the way in which the LISP "list"

is implemented internally ?

Kind Regards,

        gurucharan

--
_ Gurucharan Murudeshwar _____________________________________________________
Wipro Technologies                        Phone: +91-80-573-2293 Ext: 1104
#26, Chamundi Complex, Hosur Main Road,   mailto:gurucharan.murudeshwar@wipro.com
Bommanahalli, Bangalore 560 068 India     http://www.wipro.com



[-- Attachment #1.2: Type: text/html, Size: 926 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: LISP: Very Very Basic Question.
       [not found]     ` <mailman.4322.1049863665.21513.help-gnu-emacs@gnu.org>
@ 2003-04-09 13:50       ` lawrence mitchell
  2003-04-09 13:59       ` Kai Großjohann
  1 sibling, 0 replies; 7+ messages in thread
From: lawrence mitchell @ 2003-04-09 13:50 UTC (permalink / raw)


Gurucharan wrote:

> Hello All,
>        Can anyone explain the way in which the LISP "list"
> is implemented internally ?

It's implemented in C in Emacs.  You can find the definition in
alloc.c, if you don't have the Emacs sources handy, have a look
at: <URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/
src/alloc.c?rev=1.296&content-type=text/vnd.viewcvs-markup>

/----[ `list' implementation ]
| DEFUN ("list", Flist, Slist, 0, MANY, 0,
|        doc: /* Return a newly created list with specified
| arguments as elements.
| Any number of arguments, even zero arguments, are allowed.
| usage: (list &rest OBJECTS)  */)
|      (nargs, args)
|      int nargs;
|      register Lisp_Object *args;
| {
|   register Lisp_Object val;
|   val = Qnil;
|
|   while (nargs > 0)
|     {
|       nargs--;
|       val = Fcons (args[nargs], val);
|     }
|   return val;
| }
\----



-- 
lawrence mitchell <wence@gmx.li>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: LISP: Very Very Basic Question.
       [not found]     ` <mailman.4322.1049863665.21513.help-gnu-emacs@gnu.org>
  2003-04-09 13:50       ` lawrence mitchell
@ 2003-04-09 13:59       ` Kai Großjohann
  1 sibling, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-04-09 13:59 UTC (permalink / raw)


Gurucharan <gurucharan.murudeshwar@wipro.com> writes:

>        Can anyone explain the way in which the LISP "list"
>
> is implemented internally ?

The basic data structure is a cons cell.  It is a pair consisting of
a car and a cdr.  The car and the cdr can be numbers or strings etc,
or pointers to cons cells.

For example, (1 . 2) is a cons cell where the car is 1 and the cdr is
2.

You can build binary trees from cons cells:

( (1 . 2) . (3 . 4) )

This corresponds to the following tree:

    *
   / \
  *   *
 / \ / \
 1 2 3 4

There is a special value nil which means "empty", other languages use
the term "null".

A list is a degenerated binary tree, where the cars contain the list
elements, and the cdr points to the rest of the list.  And nil means
the empty list.  So (1 . nil) is a one-element list, and (1 . (2 .
nil)) is a two-element list, and (1 . (2 . (3 . nil))) is a
three-element list.  The three-element list as a tree:

    *
   / \
  1   *
     / \
    2   *
       / \
      3   nil

-- 
A preposition is not a good thing to end a sentence with.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: List Seperator
  2003-04-09  4:22   ` Artist
  2003-04-09  4:53     ` LISP: Very Very Basic Question Gurucharan
       [not found]     ` <mailman.4322.1049863665.21513.help-gnu-emacs@gnu.org>
@ 2003-04-09 15:04     ` Johan Bockgård
  2 siblings, 0 replies; 7+ messages in thread
From: Johan Bockgård @ 2003-04-09 15:04 UTC (permalink / raw)


googleartist@yahoo.com (Artist) writes:

> bojohan+news@dd.chalmers.se (Johan Bockgård) wrote in message
> news:<yoijfzoukp34.fsf@helm.dd.chalmers.se>...
>> googleartist@yahoo.com (Artist) writes:
>> 
>> >  I am trying to learn new function and when I try to use the
>> > function with M-1 C-x C-e it returns the list in form of a long
>> > list space seperated. I like to have it returned as new line
>> > seperated. How I can achive that?
>> 
>> Does pp-eval-last-sexp do what you want?
>> ,----
>> | Run `pp-eval-expression' on sexp before point (which see).
>> | With argument, pretty-print output into current buffer.
>> `----

> It just puts the result in another buffer. and doesn't seperate by
> new line.


Yes, that's why I included (a part of) the description (try C-h f foo)
for that command. Note 'With argument': It means that C-u M-x
pp-eval-last-sexp should do what you want (if I understood you
correctly). 


'(1 2 3 (4 (5 6)))

C-u M-x pp-eval-last-sexp =>

(1 2 3
   (4
    (5 6)))

This is what a list looks like pretty-printed.

-- 
What did you expect? The average Elisp hacker is so cool that he is in
no need of a table/desktop, placing his laptop where the name
indicates it belongs. But the precarious balance of the same is often
in need of structural support. -- DK about http://www.emacslisp.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-04-09 15:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-07 20:27 List Seperator Artist
2003-04-07 20:52 ` Johan Bockgård
2003-04-09  4:22   ` Artist
2003-04-09  4:53     ` LISP: Very Very Basic Question Gurucharan
     [not found]     ` <mailman.4322.1049863665.21513.help-gnu-emacs@gnu.org>
2003-04-09 13:50       ` lawrence mitchell
2003-04-09 13:59       ` Kai Großjohann
2003-04-09 15:04     ` List Seperator Johan Bockgård

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.