stockholm/krebs/4lib/tree.nix
2015-07-28 21:38:22 +02:00

14 lines
242 B
Nix

{ lib, ... }:
with lib;
rec {
# tree k v = set k (either v (tree k v))
# get : [k] -> tree k v -> v
get = path: tree:
if length path > 0
then get (tail path) tree.${head path} # TODO check if elem exists
else tree;
}