···14141515 /* Return an attribute from nested attribute sets.
16161717+ Nix has an [attribute selection operator `. or`](https://nixos.org/manual/nix/stable/language/operators#attribute-selection) which is sufficient for such queries, as long as the number of attributes is static. For example:
1818+1919+ ```nix
2020+ (x.a.b or 6) == attrByPath ["a" "b"] 6 x
2121+ # and
2222+ (x.${f p}."example.com" or 6) == attrByPath [ (f p) "example.com" ] 6 x
2323+ ```
2424+1725 Example:
1826 x = { a = { b = 3; }; }
1927 # ["a" "b"] is equivalent to x.a.b
···5058 attrByPath' 0 set;
51595260 /* Return if an attribute from nested attribute set exists.
6161+6262+ Nix has a [has attribute operator `?`](https://nixos.org/manual/nix/stable/language/operators#has-attribute), which is sufficient for such queries, as long as the number of attributes is static. For example:
6363+6464+ ```nix
6565+ (x?a.b) == hasAttryByPath ["a" "b"] x
6666+ # and
6767+ (x?${f p}."example.com") == hasAttryByPath [ (f p) "example.com" ] x
6868+ ```
53695470 **Laws**:
5571 1. ```nix
···176192177193 /* Like `attrByPath`, but without a default value. If it doesn't find the
178194 path it will throw an error.
195195+196196+ Nix has an [attribute selection operator](https://nixos.org/manual/nix/stable/language/operators#attribute-selection) which is sufficient for such queries, as long as the number of attributes is static. For example:
197197+198198+ ```nix
199199+ x.a.b == getAttrByPath ["a" "b"] x
200200+ # and
201201+ x.${f p}."example.com" == getAttrByPath [ (f p) "example.com" ] x
202202+ ```
179203180204 Example:
181205 x = { a = { b = 3; }; }