aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rent.scm41
1 files changed, 23 insertions, 18 deletions
diff --git a/rent.scm b/rent.scm
index 64ec3e0..6b64245 100644
--- a/rent.scm
+++ b/rent.scm
@@ -23,6 +23,7 @@
(srfi srfi-26)
(srfi srfi-71)
(srfi srfi-43)
+ (srfi srfi-171)
(ice-9 match)
(ice-9 regex)
(ice-9 string-fun)
@@ -460,21 +461,25 @@ Cycling distance to Wembley stadium: ~,1f km
;; - there is at least one tube station in the vicinity
;; - is not a bedsit
;;
-;; Sort the listed houses newest advertisments last.
-(list-houses
- (filter (lambda (house)
- (and (not (house-bills-included? house))
- (< (house-hours-live house) 100)
- (not (house-shared? house))
- (<= (house-bedrooms house) 1)
- (>= (house-rent house) 1200)
- (<= (house-rent house) 1400)
- (house-unfurnished? house)
- (house-live? house)
- (>= (house-maximum-tenants house) 2)
- (not (null? (house-tube-stations house)))
- (not (string-contains-ci (house-title house) "bedsit"))))
- (sort (all-houses)
- (lambda (house1 house2)
- (> (house-hours-live house1)
- (house-hours-live house2))))))
+;; Sort the listed houses newest advertisments first.
+(format (current-output-port)
+ "~a houses~%"
+ (list-transduce (compose (tfilter (lambda (house)
+ (and (not (house-bills-included? house))
+ (< (house-hours-live house) 100)
+ (not (house-shared? house))
+ (<= (house-bedrooms house) 1)
+ (>= (house-rent house) 1200)
+ (<= (house-rent house) 1400)
+ (house-unfurnished? house)
+ (house-live? house)
+ (>= (house-maximum-tenants house) 2)
+ (not (null? (house-tube-stations house)))
+ (not (string-contains-ci (house-title house) "bedsit")))))
+ (tlog (lambda (_ house)
+ (list-house house))))
+ rcount
+ (sort (all-houses)
+ (lambda (house1 house2)
+ (< (house-hours-live house1)
+ (house-hours-live house2))))))