anchor.diff:    # "y"] applied to some set e returns e.x.y, if it exists.  The
     # default value is returned otherwise.
     # comment: I'd rename this to getAttrRec or something like that .. (has the same name as builtin.getAttr) - Marc Weber
  -  getAttr = attrPath: default: e:
  +  getAttr = attrPath : default : e :
       let {
         attr = head attrPath;
         body =
  
positive.code:         then getAttr (tail attrPath) default (builtins.getAttr attr e)
          else default;
      };
  
  
    # Filter a list using a predicate; that is, return a list containing
  
negative.code: 
    mergeAttrs = fold ( x : y : x // y) {};
  
    # Using f = a : b = b the result is similar to //
    # merge attributes with custom function handling the case that the attribute
    # exists in both sets
    mergeAttrsWithFunc = f : set1 : set2 :
      fold (n: set : if (__hasAttr n set) 
                          then setAttr set n (f (__getAttr n set) (__getAttr n set2))
                          else set )
             set1 (__attrNames set2);
  
    # merging two attribute set concatenating the values of same attribute names
    # eg { a = 7; } {  a = [ 2 3 ]; } becomes { a = [ 7 2 3 ]; }
    mergeAttrsConcatenateValues = mergeAttrsWithFunc ( a : b : (toList a) ++ (toList b) );
  
    # returns atribute values as a list 
    flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set);
    mapIf = cond : f :  fold ( x : l : if (cond x) then [(f x)] ++ l else l) [];
  
  # Marc 2nd proposal: (not everything has been tested in detail yet..)
  
    # usage / example
    # flagConfig = {
    # } // (enableDisableFeature "flagName" "configure_feature" extraAttrs;)
    #
    # is equal to
    # flagConfig = {
    #   flagName = { cfgOption = "--enable-configure_feature"; } // extraAttrs;
    #   no_flagName = { cfgOption = "--disable-configure_feature"; };
    enableDisableFeature = flagName : configure_feature : extraAttrs :
      listToAttrs [ ( av flagName ({ cfgOption = "--enable-${configure_feature}"; } // extraAttrs ) )
                    ( av "no_${flagName}" ({ cfgOption = "--disable-${configure_feature}"; } ) )];
  
    # calls chooseOptionsByFlags2 with some preprocessing
    # chooseOptionsByFlags2 returns an attribute set meant to be used to create new derivaitons.
    # see mkDerivationByConfiguration in all-packages.nix and the examples given below.
  