anchor.diff:            nil
             (remove nil (mapcan #'fifth processed-forms)))))
   
  +(defun %process-tprogn-forms (forms)
  +  (loop :for form :in forms :collect
  +     (if (atom form) (list form t)
  +         (case (first form)
  +           (repeat (trepeat (rest form)))
  +           (then (tthen (rest form)))
  +           (progn (tprogn (rest form)))
  +           (otherwise (if (or (atom (first form))
  +                              (eq (caar form) 'lambda))
  +                          (list form t)
  +                          (cons (second form)
  +                                (%compile-time-syntax (first form)))))))))
  +
  +(defun tthen (forms)
  +  (unless (null forms)
  +    (let* ((processed-forms (%process-tprogn-forms forms))
  +           (counter-sym (gensym "counter"))
  +           (%closed-vars (remove nil (mapcan #'fifth (copy-tree processed-forms))))
  +           (let-forms (remove nil (mapcar #'fourth processed-forms)))
  +           (chain-forms 
  +            (loop :for (body test expired-test inner-let closed-vars overridep)
  +               :in processed-forms :for index :from 0
  +               :do (print index)
  +               :collect 
  +               (list expired-test
  +                     test
  +                     body
  +                     ;;when (< index (1- (length forms))) {TODO} why?
  +                     (cons `(incf ,counter-sym)
  +                           (loop :for i :in (fifth (nth (+ index 1) processed-forms))
  +                              :collect `(setf ,(first i) (second i)
  +                                              ,@(when overridep 
  +                                                      `((:override ,expired-test))))))))))
  +      (list `(let ,(when let-forms (list let-forms))
  +               ,(t-chain-expand counter-sym (print chain-forms)))
  +            `(< ,counter-sym ,(length forms))
  +            `(= ,counter-sym ,(length forms))
  +            nil
  +            (cons `(,counter-sym 0)
  +                  (cons (first %closed-vars) 
  +                        (mapcar #'listify (rest %closed-vars))))))))
  +
   (defun t-chain-expand (counter forms)
     (loop :for (expire-test run-test code initialize-next) :in (reverse forms)
        :for i :from (1- (length forms)) :downto 0 :with accum = nil :do
        (setf accum `(if ,expire-test
  -                      (progn
  -                        (when (= ,counter ,i)
  -                          ,@(print initialize-next))
  -                        ,accum)
  -                      (when ,run-test
  -                        ,code)))
  +                      (progn (when (= ,counter ,i) ,@initialize-next) ,accum)
  +                      (when ,run-test ,code)))
        :finally (return accum)))
   
  -(defun tthen+ (forms)
  +(defun trepeat (forms) 
     (let* ((processed-forms (%process-tprogn-forms forms))
            (counter-sym (gensym "counter"))
            (%closed-vars (remove nil (mapcan #'fifth (copy-tree processed-forms))))
  -         (let-forms (remove nil (mapcar #'fourth processed-forms)))
  -         (chain-forms 
  -          (loop :for (body test expired-test inner-let closed-vars)
  -             :in processed-forms :for index :from 0 :collect 
  -             (list expired-test test body
  -                   (when (< index (1- (length forms)))
  -                     (loop :for i :in (fifth (nth (+ index 1) processed-forms)) 
  -                        :append `((incf ,counter-sym) (setf ,@i))))))))
  -    (list `(let ,(when let-forms (list let-forms))
  -             ,(t-chain-expand counter-sym chain-forms))
  -          `(< ,counter-sym ,(length forms))
  -          `(= ,counter-sym ,(length forms))
  -          nil
  -          (cons `(,counter-sym 0)
  -                (cons (first %closed-vars) 
  -                      (mapcar #'listify (rest %closed-vars)))))))
  -
  -(defun trepeat+ (forms) 
  -  (let* ((processed-forms (%process-tprogn-forms forms))
  -         (counter-sym (gensym "counter"))
  -         (%closed-vars (remove nil (mapcan #'fifth (copy-tree processed-forms))))
  -         (let-forms (remove nil (mapcar #'fourth (copy-list processed-forms))))
  +         (let-forms (remove nil (mapcar #'third (copy-list processed-forms))))
            (chain-forms 
             (loop :for (body test expired-test) :in processed-forms
                :for index :from 0 :collect 
                (list expired-test test body
                      (if (= index (1- (length forms)))
  -                                          (cons `(setf ,counter-sym 0)
  -                                                (loop :for i :in (fifth (first processed-forms)) :collect `(setf ,@i)))
  -                                          (cons `(incf ,counter-sym)
  -                                                (loop :for i :in (fifth (nth (+ index 1) processed-forms)) :collect `(setf ,@i))))))))
  +                       (cons `(setf ,counter-sym 0)
  +                             (loop :for i :in (fifth (first processed-forms)) :collect `(setf ,@i)))
  +                       (cons `(incf ,counter-sym)
  +                             (loop :for i :in (fifth (nth (+ index 1) processed-forms)) :collect `(setf ,@i))))))))
       (list `(let ,(when let-forms (list let-forms))
                ,(t-chain-expand counter-sym chain-forms))
             t
  
positive.code:   (declare (ignore temporal-statements))
    (error "'Repeat' can only be used inside a tlambda*"))
  
  (add-time-predicate and (&rest forms) (values `(and ,@forms) nil 'and))
  (add-time-predicate or (&rest forms) (values `(or ,@forms) nil 'or))
  
  (add-time-predicate once () 
    (let ((runsym (gensym "run")))
      (values `(unless ,runsym (setf ,runsym t))
              `((,runsym nil)) ;;maybe move to last
              runsym
              nil)))
  
  (add-time-predicate before (deadline &key progress) 
    (unless (symbolp progress) (error "'progress' in 'each' must be a symbol"))
    (let ((deadsym (gensym "deadline"))
          (ctimesym (gensym "current-time"))
          (stimesym (gensym "start-time")))
      (values (if progress
                  `(let ((,deadsym ,deadline)
                         (,ctimesym (funcall *default-time-source*)))
                     (setf ,progress (float (- 1.0 (/ (- ,deadsym ,ctimesym) 
                                                      (- ,deadsym ,stimesym)))))
                     (beforep ,deadsym))
                  `(beforep ,deadline))
              (when progress `((,stimesym (funcall *default-time-source*))))
              `(afterp ,deadline)
              (when progress `((,progress 0.0))))))
  
  (add-time-predicate after (deadline) `(afterp ,deadline))
  
  (add-time-predicate between (start-time end-time &key progress)
    (let ((deadsym (gensym "deadline"))
          (ctimesym (gensym "current-time")))    
      (values (if progress
                  `(let ((,deadsym ,end-time)
                         (,ctimesym (funcall *default-time-source*)))
                     (setf ,progress (float (- 1.0 (/ (- ,deadsym ,ctimesym)
                                                      (- ,deadsym ,start-time)))))
                     (betweenp ,start-time ,end-time))
                  `(betweenp ,start-time ,end-time))
              nil
              `(afterp ,end-time)
              (when progress `((,progress 0.0))))))
  
  (add-time-predicate from-now (offset)
    (let ((offsetv (gensym "offset")))
      (values offsetv `((,offsetv (from-now ,offset))))))
  
  (add-time-predicate the-next (quantity)
    (let ((offsetv (gensym "offset")))
      (values `(beforep ,offsetv) `((,offsetv (from-now ,quantity))))))
  
  (add-time-predicate each (timestep &key step-var fill-var)
    (unless (symbolp step-var) (error "step-var in 'each' must be a symbol"))
    (unless (symbolp fill-var) (error "fill-var in 'each' must be a symbol"))
    (let ((stepv (gensym "stepper")))
      (values (if fill-var 
                  `(setf ,fill-var (funcall ,stepv))
                  `(funcall ,stepv)) 
              `((,stepv (make-stepper ,timestep)))
              nil
              `(,(when step-var `(,step-var ,timestep))
                 ,(when fill-var `(,fill-var ,stepv))))))
  
  ;;----------------------------------------------------------------------
  ;; Time units
  
negative.code:                    ,body)
                body)))))
  
  (defun %compile-time-syntax (form)
    (if (atom form) (list form nil nil nil)
        (let* ((tname (first form))
               (closed-arg-vars nil)
               (arg-expire-tests nil)
               (local-arg-vars nil)
               (body (loop :for item :in (rest form) :collect
                        (destructuring-bind (&optional code expired-test
                                                       local-vars closed-vars
                                                       override)
                            (%compile-time-syntax item)
                          (declare (ignore override))
                          (setf closed-arg-vars (append closed-vars closed-arg-vars))
                          (setf local-arg-vars (append local-vars local-arg-vars))
                          (when expired-test (push expired-test arg-expire-tests))
                          code
                          ))));;{TODO} handle override here
          (destructuring-bind (&optional code expired-test local-vars closed-vars
                                         override) 
              (time-syntax-expand tname body)
            (list code
                  ;;{TODO} what if not symb and arg-expire-tests?
                  (if (and (symbolp expired-test) arg-expire-tests) 
                      (cons expired-test arg-expire-tests) 
                      expired-test)
                  (remove nil (append local-vars (reverse arg-expire-tests)))
                  (remove nil (append closed-vars (reverse closed-arg-vars)))
                  override)))))
  
  (tlambda () ((before 100) (print "hi")))
  
  (defun tprogn (forms)
    (let* ((processed-forms (%process-tprogn-forms forms))
           (expire-forms (remove nil (mapcar #'third processed-forms)))
           (let-forms (remove nil (mapcan #'fourth processed-forms))))
  