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?
This might be more of an issue with your understanding of CL-WHO rather than Lisp ;)
(defun recursive-test (count) (with-html-output (*standard-output*) (if (< count 10) (recursive-test (+ count 1))) (str (format nil "Recursive count- ~A~%" count))))
Note that I am using WITH-HTML-OUTPUT instead of WITH-HTML-OUTPUT-TO-STRING. This way, output by all recursive calls would go to *standard-output* which is then be handled by TEST-RECURSIVE.
(define-easy-handler (test-recursive :uri "/test.html") () (with-html-output-to-string (*standard-output*) (recursive-test 0)))
We don't need the (STR ...) around (RECURSIVE-TEST 0) since we are not interested in the return value. Also, you don't necessarily need to use WITH-HTML-OUTPUT-TO-STRING here -- even WITH-OUTPUT-TO-STRING would work.
Chaitanya
(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