help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Seeking Understanding about Symbols, Strings, Structure and Storage


From: Nordlöw
Subject: Seeking Understanding about Symbols, Strings, Structure and Storage
Date: Fri, 6 Nov 2009 01:54:36 -0800 (PST)
User-agent: G2/1.0

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]