From 5695c47496f815b0c66ee342f2c167da746b6eee Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Fri, 23 Aug 2024 23:27:29 +0100 Subject: [PATCH] add dig to anoia --- pkgs/anoia/init.fnl | 7 +++++++ pkgs/watch-outputs/watch-outputs.fnl | 8 +------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/anoia/init.fnl b/pkgs/anoia/init.fnl index 27560fc..81105e8 100644 --- a/pkgs/anoia/init.fnl +++ b/pkgs/anoia/init.fnl @@ -62,6 +62,12 @@ (assert (not (table= {:a [4 5 6 7] } {:a [4 5 6 7 8]}))) (assert (not (table= {:a [4 5 7 6] } {:a [4 5 6 7 ]})))) +(fn dig [tree path] + (match path + [el & more] (dig (. tree el) more) + [el] (. tree el) + [] tree)) + (local base64-indices (doto [ @@ -103,6 +109,7 @@ : assoc : base64url : basename + : dig : dirname : dup : file-exists? diff --git a/pkgs/watch-outputs/watch-outputs.fnl b/pkgs/watch-outputs/watch-outputs.fnl index 6cd4865..5c5940d 100644 --- a/pkgs/watch-outputs/watch-outputs.fnl +++ b/pkgs/watch-outputs/watch-outputs.fnl @@ -1,4 +1,4 @@ -(local { : system : assoc : split : table= } (require :anoia)) +(local { : system : assoc : split : table= : dig } (require :anoia)) (local svc (require :anoia.svc)) (local { : view } (require :fennel)) (local { : kill } (require :lualinux)) @@ -22,12 +22,6 @@ :paths (split-paths paths) })) -(fn dig [tree path] - (match path - [el & more] (dig (. tree el) more) - [el] (. tree el) - [] tree)) - (fn changed? [paths old-tree new-tree] (accumulate [changed? false _ path (ipairs paths)]