first of all a big thanks for the detailed explanation.

I scoured the manual and book for all occurrences of destructive, every
so often a difference kind of use pops up, like when a counter in
incremented destructively, things like that, but wanted to see what
commands are clearly modifying the given list, like:

con, conc, fifo, pop, push, queue, rot, sort, and xchg

and opposed to things which are explicitly non-destructive (which is
the normal case and so I think it is mentioned because people might
expect them to be destructive) like:

append, delete, insert, remove, replace, and place.

and then looked at that first list, and the insert option section in my
ez_opts lib and thought heck, why not just do push??

this is getting shorter and shorter, I think I have it now:

task: destructive insert to an imbedded list (all work actually):

first version:

(de insert_opt (Id X)
   (setq *opts
      (make
         (for L *opts
            (if (= Id (car L))
               (link (place 4 L (cons X (last L))))
               (link L) ) ) ) ) )

second version:

(de insert_opt (Id X)
   (let L (nth (assoc Id *opts) 4)
      (set L (cons X (car L))) ) )

third version:

(de insert_opt (Id X)
   (push (nth (assoc Id *opts) 4) X) )

geez, that was easy! :)

> 
> No. 'set' is always destructive, because it modifies a 'var' (the
> value of a symbol, or the CAR of a cell).
> 

I still have some questions here, but am off to do some visual
diagramming first, will get back on it. But am off first to diagram a
few things, some other commands.

> 
> It is essential to understand what happens on this level. That's why
> the initial part of the PicoLisp reference dwells so much on this, in
> "The PicoLisp Machine" in http://software-lab.de/doc/ref.html#vm
> 

This is so true, and its no different in any language, spoken, sign, or
computer, the importance of this kind of "elemental feel" for them.

What is nice is that this simple program I wrote program is fully
functional and I can be using it in the meantime (I posted only the
launcher for it). It takes any flatfile you throw at it, and so I have
it doing text learning, language, also articles, pics, vids, and
slideshows, also spelling words in sign - and the dang thing is not
even two pages long with the launcher and extensions.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to