anchor.diff:    inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr;
   
   
  -  /* Return an attribute from nested attribute sets.  For instance
  -     ["x" "y"] applied to some set e returns e.x.y, if it exists.  The
  -     default value is returned otherwise. */
  +  /* Return an attribute from nested attribute sets.
  +
  +     Example:
  +       x = { a = { b = 3; }; }
  +       attrByPath ["a" "b"] 6 x
  +       => 3
  +       attrByPath ["z" "z"] 6 x
  +       => 6
  +  */
     attrByPath = attrPath: default: e:
       let attr = head attrPath;
       in
  
positive.code:       ) (attrNames set)
      );
  
    /* foldAttrs: apply fold functions to values grouped by key. Eg accumulate values as list:
       foldAttrs (n: a: [n] ++ a) [] [{ a = 2; } { a = 3; }]
       => { a = [ 2 3 ]; }
    */
    foldAttrs = op: nul: list_of_attrs:
      fold (n: a:
  
negative.code:       !(isAttrs lhs && isAttrs rhs)
      ) lhs rhs;
  
    /* Returns true if the pattern is contained in the set. False otherwise.
  
       FIXME(zimbatm): this example doesn't work !!!
  
       Example:
         sys = mkSystem { }
         matchAttrs { cpu = { bits = 64; }; } sys
         => true
     */
    matchAttrs = pattern: attrs:
      fold or false (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
        let pat = head values; val = head (tail values); in
  