aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rent.scm26
1 files changed, 13 insertions, 13 deletions
diff --git a/rent.scm b/rent.scm
index db047b7..1effb3e 100644
--- a/rent.scm
+++ b/rent.scm
@@ -347,19 +347,19 @@ characters. Else, return @code{#f}."
"Compute the cycling distance between @var{point-a} and
@var{point-b}. The returned distance is the actual distance by cycle,
and not distance as the crow flies."
- (call-with-port (open-bytevector-input-port
- (http-get*
- (string-append %osrm-base-url "/table/v1/bike/"
- (string-join (map (match-lambda
- (#(latitude longitude)
- (format #f "~a,~a" longitude latitude)))
- (list point-a point-b))
- ";")
- "?annotations=distance&sources=0&destinations=1")))
- (lambda (port)
- (/ (json-ref (json->scm port)
- "distances" 0 0)
- 1000))))
+ (match (list point-a point-b)
+ ((#(point-a-latitude point-a-longitude)
+ #(point-b-latitude point-b-longitude))
+ (call-with-port (open-bytevector-input-port
+ (http-get*
+ (format #f "~a/table/v1/bike/~a,~a;~a,~a?annotations=distance&sources=0&destinations=1"
+ %osrm-base-url
+ point-a-longitude point-a-latitude
+ point-b-longitude point-b-latitude)))
+ (lambda (port)
+ (/ (json-ref (json->scm port)
+ "distances" 0 0)
+ 1000))))))
(define (all-tube-lines)
"Return a list of all tube lines in London."