From 3bdb7754d3e4734ffbd105c88801ed8a7bcb901b Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 12 Sep 2023 20:55:08 +0100 Subject: [PATCH] replace var/each with accumulate --- examples/acquire-wan-address.fnl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/acquire-wan-address.fnl b/examples/acquire-wan-address.fnl index 07a1da0..f56030a 100644 --- 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 }