Hi, I while ago I asked how I might somehow represent a loop as a a tail call recursion, so as to give me the pattern I like without the call penalties. Since nothing was forthcoming, I took a stab at it myself. Probably my noobish attempt will be ugly to you veterans, but I was hoping if I posted it I might get suggested improvements or alternative approaches:
(de zip-set (L1 L2) (while (and L1 L2) (set (car L1) (car L2)) (setq L1 (cdr L1)) (setq L2 (cdr L2)) ) ) (de tc-recursion X (let (tc (list '@ (list 'prog (list 'zip-set (list 'car (list 'quote (car X))) '(rest)) '(setq Cont T) '(throw 'TC) ) ) ) (prog (setq Cont T) (while Cont (setq Cont NIL) (catch 'TC (run (cdr X)) ) ) ) ) ) (de tc-test () (setq A 1) (tc-recursion (A) (prinl A) (if (>= A 10) A (tc (+ A 1)) ) ) ) Please include constructive suggestions along with the criticism. -- https://qlfiles.net -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe