anchor.diff:  
       stats))
   
  -(defun build-stack (parent stack i)
  +(defun build-stack (parent stack i history fold)
     "Fold a STACK trace into PARENT, looking at the element I.
   
      This folds from the bottom of the stack, merging upwards, resulting in a normal
  -   flame graph."
  +   flame graph.
  +
  +   HISTORY and FOLD are used to fold recursive functions into themselves, hopefully simplifying
  +   the stack."
     :hidden
     ;; Increment the number of times hit
     (.<! parent :n (+ (.> parent :n) 1))
  
positive.code:   (when (>= i 1)
      (let* [(elem (nth stack i))
             (hash (.. (.> elem :source) "|" (.> elem :linedefined)))
             (child (.> parent hash))]
        (unless child
          (set! child elem)
          (.<! elem :n 0)
          (.<! parent hash child))
  
        (build-stack child stack (- i 1)))))
  
  (defun build-rev-stack (parent stack i)
    "Fold a STACK trace into PARENT, looking at the element I.
  
     This folds from the top of the stack merging downwards, resulting
     in a reverse flame graph, with the root functions.
  
     Word of warning: this generates massive messages: I would not recommend
     running this unless you really want to."
  
negative.code:   (when (<= i (# stack))
      (let* [(elem (nth stack i))
             (hash (.. (.> elem :source) "|" (.> elem :linedefined)))
             (previous (and fold (.> history hash)))
             (child (.> parent hash))]
  
        ;; If we've this function in our history already, we'll push to that.
        (when previous
          (.<! parent :n (- (.> parent :n) 1))
          (set! child previous))
  
        (unless child
          (set! child elem)
          (.<! elem :n 0)
          (.<! parent hash child))
  
        ;; If we've no previous, we push this one to the lookup and pop it again afterwards
        (unless previous (.<! history hash child))
        (build-rev-stack child stack (+ i 1) history fold)
        (unless previous (.<! history hash nil)))))
  
  
  (defun finish-stack (element)
    "This converts the lookup of ELEMENT into a sorted list with
  