Arc Forumnew | comments | leaders | submit | cut-sea's commentslogin

NetBSD

-----


Scheme

-----


With Kahua(Continuation Base Framework on Gauche):

   (define (page . args)
     (html/ (apply body/ args)))

   (define-entry (said)
     (define (end say)
       (page (p/ "you said:" say)))
     (define (here say)
       (page (a/cont/ (@@/ (cont (lambda _ (end say)))) "click here")))
     (page
      (form/cont/ (@@/ (cont (entry-lambda (:keyword say) (here say))))
        (input/ (@/ (type "text") (name "say")))
        (input/ (@/ (type "submit") (value "SAY"))))))

   (initialize-main-proc said)

-----

1 point by cut-sea 6141 days ago | link

Kahua Current.

   (use dsl-simple)

   ;; said
   (define-main-page (said)
     (selfish "say"
      (form/cont/ (entry-lambda (:keyword say)
   		 (a/cont/ (cut p/ "You say:" say) "click here"))
           (readln/ say)
           (submit/))))
and below code realize said x 5 parts in a page.

   (define-macro (s id)
     `(selfish ,(x->string id)
        (form/cont/ (entry-lambda (:keyword ,id)
   		   (div/ (a/cont/ (cut p/ "you say:" ,id) "click here")))
          (readln/ ,id)
          (submit/))))

   (define-main-page (said5)
     (node-set/ (s say1) (s say2) (s say3) (s say4) (s say5)))
Of course, these 5 said parts work independently. When text string are filled and click other link or post other submit, these filled text are kept automatically.

Characteristically as continuation based system, browser's back button attack and tab clone attack make no problem.

-----