[hunchentoot-devel] Hunchentoot Recursive Function
Phil Marneweck
zaries at global.co.za
Wed Dec 16 12:03:30 UTC 2009
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 at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
More information about the Tbnl-devel
mailing list