adder.scm 715 B

123456789101112131415161718192021222324252627282930313233
  1. ;; kawa:scheme
  2. (define (num-parameter name default)
  3. (string->number (request-parameter name default)))
  4. #<html>
  5. <head><title>Accumulating Adder</title></head>
  6. <body>
  7. <form>
  8. <table>
  9. <tr>
  10. <td>Result so far: </td>
  11. <td>
  12. <input
  13. name="sum1"
  14. value="&(+ (num-parameter "sum1" 0)
  15. (num-parameter "sum2" 0))" />
  16. </td>
  17. </tr>
  18. <tr>
  19. <td>Add to it:</td>
  20. <td>
  21. <input
  22. name="sum2"
  23. value="&(num-parameter "sum2" 1)" />
  24. </td>
  25. </tr>
  26. </table>
  27. <input type="submit" value="Submit" />
  28. </form>
  29. </body>
  30. </html>