From 3349ce0a5817e7c3cbc9caf5db8b0ca45d984214 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 21 Jul 2023 12:28:47 +0200 Subject: This does not work --- gn3-guile/README.md | 2 +- gn3-guile/web/webserver.scm | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gn3-guile/README.md b/gn3-guile/README.md index 944296a..3a9b167 100644 --- a/gn3-guile/README.md +++ b/gn3-guile/README.md @@ -10,6 +10,6 @@ GNU Guile allows you to develop against a live running web server using emacs-ge Note the leading dot. The .guix-shell is defined in `genenetwork3/gn3-guile/web` and loads required packages using GNU Guix. -Next fire up emacs with `emacs-geiser-guile` and connect to the running web server with `M-x geiser-connect` and the port 1970. Now you can not only inspect procedures, but also update any prodedure on the live server using `C-M-x` and get updated output from the webserver! +Next fire up emacs with `emacs-geiser-guile` and connect to the running web server with `M-x geiser-connect` and the port `1970`. Now you can not only inspect procedures, but also update any prodedure on the live server using `C-M-x` and get updated output from the webserver! diff --git a/gn3-guile/web/webserver.scm b/gn3-guile/web/webserver.scm index d2cabf6..6451dc5 100755 --- a/gn3-guile/web/webserver.scm +++ b/gn3-guile/web/webserver.scm @@ -12,6 +12,9 @@ (ice-9 format) (ice-9 iconv) (ice-9 receive) + ;; (ice-9 debugger) + ;; (ice-9 breakpoints) + ;; (ice-9 source) (srfi srfi-1) (srfi srfi-26) (web http) @@ -95,6 +98,13 @@ SELECT DISTINCT ?species WHERE { ;; (define (get-species-uris) ;; (map (lambda (m) (cdr (assoc "value"(cdr (car m))))) (array->list (sparql-species)))) +#! +(define-values (names res) (sparql-species-meta)) +(define table (get-rows names res)) +(define recs '()) +(compile-species recs table) +!# + (define (sparql-species-meta) (sparql-scm " PREFIX gn: @@ -129,13 +139,12 @@ SELECT ?species ?p ?o WHERE { (let* ([s (car r)] [v (cdr (cdr r))] [p (car (cdr r))] - [nrec (assoc s recs)]) ; track records - (if nrec + [nrec (sloppy-assoc s recs)]) ; find record to fill based on subject + (if (nrec) (begin - (display nrec) (set! nrec (assoc-set! nrec p v)) (set! recs (assoc-set! recs s nrec))) - (set! recs (assoc-set! recs s '())) + (set! nrec (assoc-set! nrec s '())) ;; start with empty list ))) rows) recs) -- cgit v1.2.3