all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to draw cons cell diagrams?
@ 2018-03-30  7:03 Marcin Borkowski
  0 siblings, 0 replies; 4+ messages in thread
From: Marcin Borkowski @ 2018-03-30  7:03 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

I'd like to draw ASCII-art diagrams of lists and cons cells, like the
ones found here:
(info "(elisp) Building Lists")
or here
(info "(eintr) Lists diagrammed")
or something like this.

Should I use artist-mode or is there anything in Emacs (vanilla or some
external package) to help me with that?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



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

* Re: How to draw cons cell diagrams?
       [not found] <mailman.11410.1522393467.27995.help-gnu-emacs@gnu.org>
@ 2018-03-30 20:27 ` Emanuel Berg
  2018-03-30 23:42   ` Drew Adams
       [not found]   ` <mailman.11448.1522453342.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Emanuel Berg @ 2018-03-30 20:27 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski wrote:

> I'd like to draw ASCII-art diagrams of lists
> and cons cells, like the ones found here:
> (info "(elisp) Building Lists") or here (info
> "(eintr) Lists diagrammed") or something
> like this.

Interesting idea, and I think you could do it
quite well if you just succeed in hooking one
(a single) car into a cdr, because if you do
that, after that everything would follow with
"expanding recursion". This is how a simple
data structure, for example a tree, is turned
into a diagram, and what is a tree if not just
a nested list?

Perhaps this is an Org-mode thing BTW?

The only reservation is, isn't that kind of
expert manipulation of lists, even among
Lispers, a thing of the past?

In all my Elisp I have only 8 "cons". But then
again everyone isn't me, so maybe I'm wrong
here - in all my Elisp, I'd say that has
happened about 8 times as well :)

But to get this post back on the constructive
path, the way I would approach this idea is
like many other ideas that amount to automate
stuff, which Emacs, Elisp and in essence all
programming/computing is all about, the way I'd
take the first step is by doing it manually!

So, if you don't mind, provide us with a list
in code, and then the corresponding "ASCII art"
(yuk, that word), and even tho this kind of
task is more suited for clear-headed kids and
very young men, I think we could pull it off,
God willing :)

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* RE: How to draw cons cell diagrams?
  2018-03-30 20:27 ` How to draw cons cell diagrams? Emanuel Berg
@ 2018-03-30 23:42   ` Drew Adams
       [not found]   ` <mailman.11448.1522453342.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Drew Adams @ 2018-03-30 23:42 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

> The only reservation is, isn't that kind of
> expert manipulation of lists, even among
> Lispers, a thing of the past?

Huh?

> In all my Elisp I have only 8 "cons".

You might have only 8 calls to `cons'.  But your
code likely uses thousands of conses (aka cons
cells).

Except for atomic data types (strings, symbols
(including nil), vectors, arrays, numbers, 
buffers, windows, frames, etc.), everything in
Lisp is built with cons cells.

Yeah, that's just a tautology.
(not (atom X)) == (consp X)



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

* Re: How to draw cons cell diagrams?
       [not found]   ` <mailman.11448.1522453342.27995.help-gnu-emacs@gnu.org>
@ 2018-03-31 16:28     ` Emanuel Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2018-03-31 16:28 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>> In all my Elisp I have only 8 "cons".
>
> You might have only 8 calls to `cons'.
> But your code likely uses thousands of conses
> (aka cons cells).

Well, you might have written only 8 programs in
C, but your OS is in C, and almost all the
tools are as well.

Or, you might have done binary/bitwise
arithmetics only 2^3 times, but even typing
this message, this has happened qudrazillions
of times!

(Actually, I have no idea how many times it has
happened. But because I asked, it is probably
either really low or really high.)

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

end of thread, other threads:[~2018-03-31 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.11410.1522393467.27995.help-gnu-emacs@gnu.org>
2018-03-30 20:27 ` How to draw cons cell diagrams? Emanuel Berg
2018-03-30 23:42   ` Drew Adams
     [not found]   ` <mailman.11448.1522453342.27995.help-gnu-emacs@gnu.org>
2018-03-31 16:28     ` Emanuel Berg
2018-03-30  7:03 Marcin Borkowski

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.