[plt-scheme] Why does this code pause at the end

From: wooks (wookiz at hotmail.com)
Date: Fri Mar 5 12:40:31 EST 2010

Running this in Advanced Student. It's a fast version of Pascals
Triangle implemented by computing each row before it returns a result.

The program returns it's result but a (relatively) long pause ensues
before the scheme prompt appears. Wondering why.

(define (pascal-row row)
  (cons 1
        (local [(define (sum-neighbours row)
                  (if (or (empty? row)
                          (empty? (rest row)))
                      (cons (+ (first row) (second row))
                            (sum-neighbours (rest row)))))]
          (sum-neighbours row))))

(define (pascal n k)
    [(> k n) (pascal k n)]
    [else (local [(define (pascal m previous-row)
                      [(= m n) (+ (list-ref previous-row (sub1 k))
                                  (list-ref previous-row k))]
                      [else (pascal (add1 m) (pascal-row previous-
            (pascal 0 empty))]))
(pascal 345 235)

Posted on the users mailing list.