diff options
author | Arun Isaac | 2023-09-26 10:29:31 +0100 |
---|---|---|
committer | Arun Isaac | 2023-09-26 10:29:31 +0100 |
commit | daf0cbf0df354753382b43c5ca21275a4722761a (patch) | |
tree | ed5635cd38d2e908b6e5ea1dff819d61c97fc94b | |
parent | b466a96db3ceeddc8f28814309ba1bae9136ccbd (diff) | |
download | rent-in-london-daf0cbf0df354753382b43c5ca21275a4722761a.tar.gz rent-in-london-daf0cbf0df354753382b43c5ca21275a4722761a.tar.lz rent-in-london-daf0cbf0df354753382b43c5ca21275a4722761a.zip |
Add date comparison predicates.
* rent.scm (make-date-comparer, date<=?, date>=?): New functions.
-rw-r--r-- | rent.scm | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -154,6 +154,19 @@ somewhere in @var{html}, a string." (add-duration (date->time-utc date) (make-time time-duration 0 (* days 24 60 60))))) +(define (make-date-comparer time-predicate) + "Return a predicate that compares two dates by converting them to +times and comparing them using @var{time-predicate}." + (lambda (date1 date2) + (time-predicate (date->time-utc date1) + (date->time-utc date2)))) + +(define date<=? + (make-date-comparer time<=?)) + +(define date>=? + (make-date-comparer time>=?)) + (define (all-houses) "Return a list of all houses on the OpenRent index page." (let ((html (bytevector->string (http-get* %openrent-index-url |