From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Seeking Understanding about Symbols, Strings, Structure and Storage
Date: Fri, 6 Nov 2009 01:54:36 -0800 (PST) [thread overview]
Message-ID: <b64391f5-ede0-4f32-af11-3cd891632d4b@w19g2000yqk.googlegroups.com> (raw)
I am trying really hard to get a unified view about all the atomic
types and containers/structures/links (e)lisp provides me with:
What is the best (efficient) way to store symbols (references)
extracted from an obarray?
Should I intern them in a new array or should I store them in a
sequence?
Does interning symbols in an obarray require more memory than storing
them in a vector?
When should I intern symbols in an obarray?; My guess: When I need
fast (hashed) lookup of them.
If I store symbols in a list, say '(a b), are these symbols "free",
compared to if I first intern them?
I have heard the we should always prefer symbols before strings, when
we can. Why?;
I guess symbols require less memory because they don't carry string
attributes. Are the any other reasons?
If I want to build a tree or even a cyclic graph (I guess this is
possible because there are rings) do we always need to construct these
from cons-cells?
If so how do we realize this?: I know that setcar,setcdr,setf can play
a key-role here. What happens if I try to print such an expression
using princ(), prin1()?
For example how should we efficiently store a parse tree of tokens
having properties?:
My suggestion: As a cons-tree of symbols were the symbols are interned
in an obarray having properties accessed using get() and put().
If I assign the same long symbol to many variables is it assigned by
reference, kind of like pointers in C? Example:
(setq x 'loooooooooooooooooooong y 'loooooooooooooooooooong)
Is there some web-page out there that highlights the choices the (e)
lisp designers made concerning these things?
Thanks,
Nordlöw
next reply other threads:[~2009-11-06 9:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-06 9:54 Nordlöw [this message]
2009-11-06 12:03 ` Seeking Understanding about Symbols, Strings, Structure and Storage Pascal J. Bourguignon
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b64391f5-ede0-4f32-af11-3cd891632d4b@w19g2000yqk.googlegroups.com \
--to=per.nordlow@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).