;;; -*- Mode:LISP; Base:10 -*-

;;; See the 'condition-bind below for info on how to have the pdl
;;; auto-grow itself.

;;; Compile this, then try (gfac 2000.) versus (fac 2000.)

(defun fac(x)
  (check-type x fixnum)
  (if (zerop x) 1
    (* x (fac (1- x)))))

(defun gfac(x)
  (condition-bind
    ((sys:pdl-overflow
       #'(lambda(e) (send e :proceed :grow-pdl))))
    (fac x)))

