Thanx Alex.

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

Your answer demonstrates how Lisp dialects have grown in different
directions. For instance, in two currently most popular Common Lisp
books "Practical Common Lisp" and "Land of Lisp", function
make-symbol is not mentioned at all.

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

Now you confused me. I believed that even with transient symbols, one
still needs alpha-conversion, i.e. substituting original symbols in
S-expressions with new, transient symbols.

Could you demonstrate technique you'd use implementing this simple,
but hard example on a 'safe way' in Picolisp:

(define (hard-example f)
   (inc hard-example-calls)  ;it would be inc ' in Pico
   (for(i 1 3)
     (if (= hard-example-calls 1)
         (hard-example '(lambda(x)i))) ; passes i as a free var
     (print (f i) " ")))

(setq hard-example-calls 0)
(hard-example (lambda(x)x))

Intended output is              1 1 1 1 2 3
Accidental overshadowing gives  1 2 3 1 2 3


Reply via email to