From: Tim Vaughan Date: Fri, 3 May 2019 10:34:56 +0000 (+0200) Subject: Add expression evaluation. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=scratchy.git;a=commitdiff_plain;h=80b558dda9342206b8aab33bb7b967bfe9fb0553 Add expression evaluation. --- diff --git a/burrow.scm b/burrow.scm index c258311..afdee12 100644 --- a/burrow.scm +++ b/burrow.scm @@ -135,6 +135,7 @@ (define (serve-record record path config) (match record (('shell command) (serve-shell-command command)) + (('eval expression) (serve-expression expression)) ((type display-string selector host port) (print type display-string "\t" selector "\t" host "\t" port "\r")) ((type display-string selector host) @@ -156,6 +157,10 @@ (let-values (((in-port out-port id) (process command))) (for-each serve-info-record (read-lines in-port)))) +(define (serve-expression expression) + (for-each serve-info-record + (string-split (conc (eval expression)) "\n"))) + ;;; main (define (main) @@ -174,9 +179,9 @@ (run-server (make-server-config root hostname port)) (error "Invalid port argument." port)))))) -(main) +;; (main) -;; (define (test) -;; (run-server (make-server-config "gopher-root" "localhost" 70))) +(define (test) + (run-server (make-server-config "gopher-root" "localhost" 70))) ;; (test)