This commit is contained in:
Victor Fors 2022-04-20 23:34:53 +02:00
parent 97cc220042
commit ab7bd261e6

View File

@ -6,6 +6,7 @@
(import srfi-1) (import srfi-1)
(import (chicken io)) (import (chicken io))
(import srfi-13) (import srfi-13)
(import srfi-14)
(define (curry fn a) (define (curry fn a)
(lambda (b) (lambda (b)
@ -64,7 +65,8 @@
;;; Given a list of either symbols or strings and an association list: ;;; Given a list of either symbols or strings and an association list:
;;; look up every symbol from left to right in the association list and replace it with the value found ;;; look up every symbol from left to right in the association list and replace it with the value found
;;; then concatenate the resulting list of strings ;;; then concatenate the resulting list of strings.
;;; Inspired by Python 3's dictionary formatting string syntax.
(define (format-assoc statement ln) (define (format-assoc statement ln)
(apply string-append (apply string-append
(map (curry2 upon symbol? (compose ->string (curry (flip value) ln))) statement))) (map (curry2 upon symbol? (compose ->string (curry (flip value) ln))) statement)))
@ -76,7 +78,7 @@
;;; The API key is an alphanumeric string of length 32 ;;; The API key is an alphanumeric string of length 32
;;; The Linköping municipal open data API key generator portal is located at http://opendata.linkoping.se ;;; The Linköping municipal open data API key generator portal is located at http://opendata.linkoping.se
(define parking-key (define parking-key
(with-input-from-file "key-parking" read-line)) (string-delete char-set:whitespace (with-input-from-file "key-parking" read-line)))
;;; Get a list of parking lots with various metadata from the municipal servers. ;;; Get a list of parking lots with various metadata from the municipal servers.
;;; It should be noted that this API is both glitchy and bugged. Two bugs have been noted: ;;; It should be noted that this API is both glitchy and bugged. Two bugs have been noted: