Add 15.nix
This commit is contained in:
parent
dd206c75f1
commit
ce962efde7
|
@ -0,0 +1,18 @@
|
||||||
|
with import <nixpkgs> { };
|
||||||
|
with stdenv.lib;
|
||||||
|
let
|
||||||
|
attr = {a="a"; b = 1; c = true;};
|
||||||
|
s = "b";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
#replace all X, everything should evaluate to true
|
||||||
|
ex0 = isAttrs attr;
|
||||||
|
ex1 = attr.a == "a";
|
||||||
|
ex2 = attr.${s} == 1;
|
||||||
|
ex3 = attrVals ["c" "b"] attr == [ true 1 ];
|
||||||
|
ex4 = attrValues attr == [ "a" 1 true ];
|
||||||
|
ex5 = builtins.intersectAttrs attr {a="b"; d=234; c="";}
|
||||||
|
== { a = "b"; c = "";};
|
||||||
|
ex6 = removeAttrs attr ["b" "c"] == { a="a"; };
|
||||||
|
ex7 = ! attr ? a == false;
|
||||||
|
}
|
Loading…
Reference in New Issue