Hi Kazimir,

this question sounds rather strange to me. You could also ask "Why do
you construct new cells?" or "Why does your program generate numbers?"

> I'm trying to write review of the reasons for use of the generated
> symbols in Lisp dialects. I'm interested in experiences of Picolisp
> community. These are generated with sym and new, but other functions
> are also of interest.

The most common function to generate new symbols, btw, is 'read'. But
also database accesses and the system itself (at startup) generate

> 1. Generation of expressions processed by programs.

In my experience, there is usually no need to especially generate
symbols for that. That is, you normally just 'read' the symbols.

> 2. Alpha-conversion, i.e. prevention of symbol clashes when calling
>    macros. It is equivalent of use of (gensym) in other Lisp dialects
>   in macro definition.

No need for that in PicoLisp. You use transient symbols to avoid

> 3. Bulk definitions of functions or macros using same algorithm, for
>    example, defining operators setq+, setq-, setq* ... such that
>    (setq+ a b) <=> (setq a (+ a b)),
>    (setq- a b) <=> (setq a (- a b))

Yes, you might do that, by generating symbol names, 'intern'ing them,
and use 'curry' or something similar to build definitions.

> 4. Simulation of hash tables. Instead of B["011101"] in some other
>    language, I just use generated symbol B011101.

Possible. But I wouldn't abuse the internal symbol table for that, as it
is global and you still might have name clashes. Better use some data
structure like 'idx', or the database.

> Could you list some other reasons for use of generated symbols in
> Picolisp? Even if it looks trivial to you, it probably doesn't look
> that way to me.

Well, the most obvious case is generating objects (in the OOP sense).
Then: Everything where string processing is used in other languages.

- Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to