hi all,

I want to share something very important related to picolisp:

Half year ago I was wonder how to implement (prog3) (return third evaluated
expression) (without success), Regenaxer implemented it for me. I promised
I understand it someday. This day came, *now* I understand how (run) works
and why. This is so simple and important as core principle. Look at this
two versions of (prog3) from Alexander:
(de prog3-1 (A B Res . Prg)
   (run Prg 1)
   Res )
(de prog3-2 (A B Res . @) Res)

As you may know (do) function has this form:
(do 'flg|num ['any | (NIL 'any . prg) | (T 'any . prg) ..]) -> any

Someday I was wonder how to implement (do) without NIL and T checks of
I've implemented it via (run) as a try:
(de dotimes (N . Prg)
   (while (ge0 (dec 'N))
      (run Prg 1) ) )
(let (A -1  B 0  Prg 777)
   (dotimes 5
      (inc 'A)
      (setq Prg (>> 1 Prg))
      (dec 'B) )
            (= A 4)
            (= B -5)
            (= Prg 24) ) ) ) )

(dotimes) much slower than (do) anyway in this form and understandable why:
   (do 10000000) )
0.117 sec
   (dotimes 10000000) )
2.403 sec


Reply via email to