summaryrefslogtreecommitdiffstats
path: root/4lib/krebs/tree.nix
blob: 1cd83b3f67f9c26ee1a0f116e3010ef178f45fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
{ 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;
}