Removed imports.
[microbotany.git] / water.scm
1 ;; Water garden
2 ;;
3
4 (lambda (uri)
5   (for-each eval (with-input-from-file "garden.scm" read-list))
6   (let ((query (uri-query uri)))
7     (if (null? query)
8         (begin
9           (print "=> register.scm Please register first."))
10         (let ((hash (symbol->string (caar query))))
11           (condition-case
12               (let* ((g (with-input-from-file (make-pathname "accounts" hash) read)))
13                 (water-garden! g)
14                 (with-output-to-file (make-pathname "accounts" hash)
15                   (lambda ()
16                     (write g)))
17                 (redirect-permanent (update-uri uri
18                                                 path: '(/ "microbotany" "view.scm")
19                                                 query: `((,hash . #t)))))
20             (o (exn)
21                (print "This garden no longer exists.\n\n"
22                       "=> register.scm Register to create another.")))))))
23