This commit is contained in:
Victor Fors 2022-04-18 21:14:20 +02:00
parent 89ba2d6aef
commit 838b9bf5f1

View File

@ -28,7 +28,7 @@
(define (sort-via less-than? fn ln)
(sort ln (lambda (a b)
(less-than? (fn a) (fn b)))))
(less-than? (fn a) (fn b)))))
(define (display-newline str)
(display str)
@ -36,16 +36,16 @@
(define (->string a)
(cond ((string? a) a)
((symbol? a) (symbol->string a))
((number? a) (number->string a))
((char? a) (string a))))
((symbol? a) (symbol->string a))
((number? a) (number->string a))
((char? a) (string a))))
(define (format-assoc statement ln)
(apply string-append
(map (lambda (directive)
(if (symbol? directive)
(->string (value directive ln))
directive)) statement)))
(map (lambda (directive)
(if (symbol? directive)
(->string (value directive ln))
directive)) statement)))
(define (simple-json-request uri)
(with-input-from-request uri #f read-json))
@ -70,6 +70,6 @@
(display-newline "Parking spaces available:")
(let ((lots (sort-via string-ci<? (curry value 'Name) (get-parking-lots))))
(map (compose display-newline (curry format-assoc '(Name ": " ParkingSpacesAvailable "/" ParkingSpaces)))
(filter (conjoin computerized? (complement only-has-handicap-spots?)) lots))))
(filter (conjoin computerized? (complement only-has-handicap-spots?)) lots))))
(main)