From ce962efde7b47e7e8930140f346215062b302d4c Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 14 Apr 2022 10:15:52 +0000 Subject: [PATCH] Add 15.nix --- 15.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 15.nix diff --git a/15.nix b/15.nix new file mode 100644 index 0000000..3db6c09 --- /dev/null +++ b/15.nix @@ -0,0 +1,18 @@ +with import { }; +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; +} \ No newline at end of file