mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
336908cf4c
Always traverse the shortest set.
50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
let
|
|
alphabet =
|
|
{ a = "a";
|
|
b = "b";
|
|
c = "c";
|
|
d = "d";
|
|
e = "e";
|
|
f = "f";
|
|
g = "g";
|
|
h = "h";
|
|
i = "i";
|
|
j = "j";
|
|
k = "k";
|
|
l = "l";
|
|
m = "m";
|
|
n = "n";
|
|
o = "o";
|
|
p = "p";
|
|
q = "q";
|
|
r = "r";
|
|
s = "s";
|
|
t = "t";
|
|
u = "u";
|
|
v = "v";
|
|
w = "w";
|
|
x = "x";
|
|
y = "y";
|
|
z = "z";
|
|
};
|
|
foo = {
|
|
inherit (alphabet) f o b a r z q u x;
|
|
aa = throw "aa";
|
|
};
|
|
alphabetFail = builtins.mapAttrs throw alphabet;
|
|
in
|
|
[ (builtins.intersectAttrs { a = abort "l1"; } { b = abort "r1"; })
|
|
(builtins.intersectAttrs { a = abort "l2"; } { a = 1; })
|
|
(builtins.intersectAttrs alphabetFail { a = 1; })
|
|
(builtins.intersectAttrs { a = abort "laa"; } alphabet)
|
|
(builtins.intersectAttrs alphabetFail { m = 1; })
|
|
(builtins.intersectAttrs { m = abort "lam"; } alphabet)
|
|
(builtins.intersectAttrs alphabetFail { n = 1; })
|
|
(builtins.intersectAttrs { n = abort "lan"; } alphabet)
|
|
(builtins.intersectAttrs alphabetFail { n = 1; p = 2; })
|
|
(builtins.intersectAttrs { n = abort "lan2"; p = abort "lap"; } alphabet)
|
|
(builtins.intersectAttrs alphabetFail { n = 1; p = 2; })
|
|
(builtins.intersectAttrs { n = abort "lan2"; p = abort "lap"; } alphabet)
|
|
(builtins.intersectAttrs alphabetFail alphabet)
|
|
(builtins.intersectAttrs alphabet foo == builtins.intersectAttrs foo alphabet)
|
|
]
|