Arc Forumnew | comments | leaders | submit | edw's commentslogin

This solution blows--like many others--because it explicitly references a session. Additionally, explicitly referencing a form instead of implicitly providing form values to a procedure is pointless drudgery. Explicit session and state are like having to access all of your Python variables via globals['foo'] or locals['bar'].

The Arc Challenge isn't about Turing completeness: We know you can build a web app using an app server written in Conway's Game of Life, and while that's an interesting curiosity, it's not something that's pushing forward the state of the art. The challenge--for me, at least--is about thinking about how we can make the plumbing of a web application disappear, so we don't need to think about it any more.

-----


    ;; Should be available at <http://poseur.com:8080/said>.
    ;;
    ;; Full source at <http://poseur.com/magic3/magic3.scm>.
    
    (define-handler (said)
      (send-xml!
       (form (message)
             '(((input type text name message))
               ((input type submit value "Go")))
             (send-xml!
              (link "click here" (send-xml! `(p you said: ,message)))))))
    
    ;; Start thusly: (spawn serve)

-----

3 points by edw 6092 days ago | link

And now, because you guys worship brevity so...

    (define-handler (said)
      (send-xml
       (form (message)
             `(,(field message) ,(submit "Go"))
             (send-xml (link "click here" (send-xml `(p you said: ,message)))))))

-----

2 points by edw 6070 days ago | link

Now, slightly longer, but emits real XHTML and uses AJAX to place the result in the DOM:

    (define-handler (said)
      (page
       "Arc Challenge"
       (form (message)
             `(,(field message) ,(submit "Go"))
             (page "Almost"
                   (ajax-link "Click here" 'message
                              `(p "You said: " ,message))
                   `((div id message))))))

-----

2 points by edw 6069 days ago | link

Now, slightly shorter, more clear, is AJAXian from start to finish:

    (define-handler (said)
      (page
       "Arc Challenge"
       (ajax-form 'output (message)
                  `(,(field message) ,(submit "Go"))
                  `(p
                    ,(ajax-link "Click here" 'output
                                `(p "You said: " ,message))))
       '((div id output))))

-----

1 point by edw 6131 days ago | link | parent | on: I hereby propose...

How about "programmer"? If you guys were to spend as much time creating products as you do on stupid questions like this, you might have a term sheet from Yahoo or Google in front of you.

-----

2 points by kennytilton 6131 days ago | link

Yer no fun. :) How about "geeks": we actually enjoy this stuff! And lemme tell you something, for twelve years I have been <ugh> a Lisper -- do not leave this to chance! :)

-----