this one hangs after about 5 minutes: $ csi -s geojson-generator.scm | csi -s ./arp-boats.scm -:g -:hm16M 2>&1 | grep resize -C 5 ;; boat service: (use matchable cjson srfi-18) ;; workaround for blocking on i/o when reading json from stdin (include "nonblocking-input-ports.scm") (current-input-port (open-input-file*/nonblock 0)) ;; ==================== debug (thread-start! (lambda () (use nrepl) (nrepl 1234))) ;; ==================== globals (define state '()) ;; ==================== boat utils (define (geojson-mmsi geojson) (let ((mmsi (alist-ref 'mmsi (or (alist-ref 'properties geojson) '())))) (assert (number? mmsi)) mmsi)) ;; (pp (extract (include "./boat.data.scm"))) ;; input: alist ((pos . (lat . lon)) (mmsi . mmsi)) ;; state is a map of : (define (prj-geojson geojson state) (assert (<= (length state) 20000)) ;; set properties for mmsi key: (alist-update (geojson-mmsi geojson) ;; key (mmsi) geojson ;; value (geojson feature) state)) (define count 0) (port-for-each (lambda (line) (let ((json (string->json line))) (set! count (add1 count)) (set! state (prj-geojson json state)))) read-line)