Ok I got some help in #lisp
I now have the following:
(defun recursive-test (count) (with-html-output (*standard-output*) (if (< count 10) (recursive-test (+ count 1)))
(str (format nil "Recursive count- ~A" count))))
(define-easy-handler (test-recursive :uri "/test.html" :default-request-type :both) () (with-html-output-to-string (*standard-output*) (recursive-test 0)))
Which gives me:
Recursive count- 10Recursive count- 9Recursive count- 8Recursive count- 7Recursive count- 6Recursive count- 5Recursive count- 4Recursive count- 3Recursive count- 2Recursive count- 1Recursive count- 0Recursive count- 0
Why do I get 2 Recursive count- 0?
Is this hunchentoot or am I not understanding recursion in lisp?
On Wed, 2009-12-16 at 13:20 +0200, Phil Marneweck wrote:
This is most likely a problem with my understanding of lisp and not hunchnetoot.
Why does the following function only out put "Recursive count- 0" to the hunchentoot page?
(defun recursive-test (count) (with-html-output-to-string (*standard-output*) (if (< count 10) (recursive-test (+ count 1))) (str (format nil "Recursive count- ~A" count))))
(define-easy-handler (test-recursive :uri "/test.html" () (with-html-output-to-string (*standard-output*) (str (recursive-test 0))))
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel