aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rent.scm13
1 files changed, 6 insertions, 7 deletions
diff --git a/rent.scm b/rent.scm
index 08e8dde..ac71d56 100644
--- a/rent.scm
+++ b/rent.scm
@@ -326,18 +326,17 @@ characters. Else, return @code{#f}."
'())))
(*default* . ,handle-default))))
-(define (house-cycling-distance house)
- "Compute the cycling distance between @var{house} and work. The
-returned distance is the actual distance by cycle, and not distance as
-the crow flies."
+(define (cycling-distance point-a point-b)
+ "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 (house-coordinates house)
- %work-coordinates))
+ (list point-a point-b))
";")
"?annotations=distance&sources=0&destinations=1")))
(lambda (port)
@@ -387,7 +386,7 @@ Cycling distance: ~,1f km
%openrent-base-url
(house-property-id house)
(house-rent house)
- (house-cycling-distance house))
+ (cycling-distance (house-coordinates house) %work-coordinates))
(match (house-tube-stations house)
(() (display "No tube!"))
(tube-stations