commit 3bdb7754d3e4734ffbd105c88801ed8a7bcb901b
parent 8f97c5bf3c0afd9593db7e3a4c09e5f00863d9a2
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 12 Sep 2023 20:55:08 +0100
replace var/each with accumulate
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/examples/acquire-wan-address.fnl b/examples/acquire-wan-address.fnl
@@ -31,14 +31,13 @@
new-addresses))
(fn run []
- (var addresses [])
(let [[state-directory wan-device] arg
dir (svc.open state-directory)]
- (each [v (dir:events)]
+ (accumulate [addresses []
+ v (dir:events)]
;; we don't handle unbound or stopped, where we should
;; take the addresses away
(when (. bound-states (v:output "state"))
- (set addresses
- (update-addresses wan-device addresses (v:output "address")))))))
+ (update-addresses wan-device addresses (v:output "address"))))))
{ : update-addresses : changes : run }