On Mon, May 24, 2021 at 08:03:35PM -0500, polifemo wrote: > As I refactor pil21 for my amusement, I've found the function '+ being used > on single numbers. What is this for? As far as I could think, it might have > to do something with formatting... but I really can't think of anything. > > here are two examples, in related operations: > > (de timeout (N) > (if2 N (assoc -1 *Run) > (set (cdr @) (+ N)) # here > (push '*Run (list -1 (+ N) '(bye))) # here > (del @ '*Run) ) ) > > it is also used inside 'task, in this expression: > `(link (+ (eval (++ Prg) 1)))` > , though the entire thing is too long for me to comfortably paste here.
Very good that you found this! The unary '+' calls in the above cases are obsolete in pil21. They are remnants from pil32, I will remove them. They were necessary because pil32 did not have short numbers - only bignums each occupying one or more cells. The internal event handler operating on '*Run' modified (decremented) these values destructively for efficiency reasons. Therefore, numbers passed to 'task' or 'timeout' had to be protected. The unary '+' call works like a 'copy' on the number. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe