[ginseng-cvs] CVS ginseng/examples

wchunye wchunye at common-lisp.net
Sat Sep 11 15:50:42 UTC 2010


Update of /project/ginseng/cvsroot/ginseng/examples
In directory cl-net:/tmp/cvs-serv24595/examples

Modified Files:
	app-inc-counter.lisp hello-world.lisp sum-of.lisp 
Log Message:
update documents and examples

--- /project/ginseng/cvsroot/ginseng/examples/app-inc-counter.lisp	2010/08/11 12:02:36	1.2
+++ /project/ginseng/cvsroot/ginseng/examples/app-inc-counter.lisp	2010/09/11 15:50:42	1.3
@@ -30,8 +30,6 @@
       (<:as-html "  ")
       (<:a :href (dynamic-url (counter-main (1- counter))) "--")
       ))))
-
-
 (defun http-add-two-numbers (&optional (next-action nil))
   (invoke-next-action next-action :main #'(lambda () (add-two-numbers-main))))
 (defun add-two-numbers-main ()
@@ -41,16 +39,14 @@
       (<:title "Add two number"))
      (<:body
       (<:h1 "Please input the first number:")
-      (let ((cf (make-callback-factory))
-            (first-number 0))
+      (let ((first-number 0))
         (<:form :action (dynamic-url
-                          (apply-callbacks cf)
+                          (apply-callbacks)
                           (input-next-number first-number))
                 (<:input :type :text
-                         :name (create-callback cf 
-                                                #'(lambda (v) (setq first-number v))
-                                                :type 'integer))
-                ))))))
+                         :name (with-call-back (v :type 'integer)
+                                 (setf first-number v))
+                         )))))))
 (defun input-next-number(first-number)
   (yaclml:with-yaclml-output-to-string
     (<:html 
@@ -59,16 +55,13 @@
      (<:body
       (<:h1 (<:as-html "Add to " first-number  "."
                        " Please input the second number:"))
-      (let ((cf (make-callback-factory))
-            (second-number 0))
+      (let ((second-number 0))
         (<:form :action (dynamic-url 
-                          (apply-callbacks cf)
+                          (apply-callbacks)
                           (add-the-two-numbers first-number second-number))
                 (<:input :type :text
-                         :name (create-callback cf 
-                                                #'(lambda (v) (setq second-number v))
-                                                :type 'integer))
-                ))))))
+                         :name (bindf second-number 'integer)))
+        )))))
 (defun add-the-two-numbers ( a b )
   (yaclml:with-yaclml-output-to-string
     (<:html 
--- /project/ginseng/cvsroot/ginseng/examples/hello-world.lisp	2010/08/11 12:02:36	1.2
+++ /project/ginseng/cvsroot/ginseng/examples/hello-world.lisp	2010/09/11 15:50:42	1.3
@@ -32,4 +32,4 @@
        (<:ol 
         (dolist (arg args)
           (<:li (<:as-html arg)))
-        ))))))
\ No newline at end of file
+        ))))))
--- /project/ginseng/cvsroot/ginseng/examples/sum-of.lisp	2010/08/09 12:27:25	1.1
+++ /project/ginseng/cvsroot/ginseng/examples/sum-of.lisp	2010/09/11 15:50:42	1.2
@@ -1,17 +1,9 @@
 (in-package :ginseng-examples)
 (defun http-sum-of(&rest args)           
-  (with-yaclml-output-to-string
-    (<:html
-     (<:head
-      (<:title "Sum of numbers"))
-     (<:body 
-      (<:h1 "Sum of numbers")
+  (with-html "sum of numbers"
+    (let ((a-list-of-number (mapcar #'(lambda (x) 
+                                        (or (parse-integer x :junk-allowed t) 0)) 
+                                    args)))
       (<:p      
-       (<:as-html (format nil "~{~A~^+~}" args) "="
-                    (apply #'+ 
-                           (mapcar #'(lambda (x) 
-                                       (or 
-                                        (parse-integer x
-                                                       :junk-allowed t)
-                                        0)) 
-                                   args))))))))
\ No newline at end of file
+       (<:as-html (format nil "~{~A~^+~}" a-list-of-number) "="
+                  (apply #'+ a-list-of-number))))))
\ No newline at end of file





More information about the ginseng-cvs mailing list