lib: remove upstreamed function repeat
(replicate
)
This commit is contained in:
parent
b5874e2bcd
commit
0137f4f5a9
@ -284,9 +284,7 @@ in rec {
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (extendedLib.strings) repeatString;
|
||||
|
||||
inherit (lib.lists) range flatten;
|
||||
inherit (extendedLib.lists) repeat;
|
||||
|
||||
inherit (lib.lists) range flatten replicate;
|
||||
inherit (lib.attrsets) nameValuePair listToAttrs;
|
||||
|
||||
nthCds = n: [
|
||||
@ -296,7 +294,7 @@ in rec {
|
||||
("." + toString n)
|
||||
(".." + toString n)
|
||||
];
|
||||
realCommand = n: "cd " + (concatStringsSep "/" (repeat ".." n));
|
||||
realCommand = n: "cd " + (concatStringsSep "/" (replicate n ".."));
|
||||
|
||||
nthCdsAsNameValuePairs = n: map (cmd: nameValuePair cmd (realCommand n)) (nthCds n);
|
||||
allCdNameValuePairs = flatten (map nthCdsAsNameValuePairs (range 1 9));
|
||||
|
@ -2,7 +2,7 @@
|
||||
rec {
|
||||
attrsets = import ./attrsets.nix { inherit stdlib; };
|
||||
lists = import ./lists.nix { inherit stdlib; };
|
||||
strings = import ./strings.nix { inherit stdlib lists; };
|
||||
strings = import ./strings.nix { inherit stdlib; };
|
||||
termColors = import ./termColors.nix { inherit stdlib strings; };
|
||||
trivial = import ./trivial.nix { inherit stdlib; };
|
||||
}
|
||||
|
@ -3,9 +3,6 @@ let
|
||||
inherit (stdlib.trivial) const;
|
||||
inherit (stdlib.lists) range any all;
|
||||
in {
|
||||
# a -> Int -> [a]
|
||||
repeat = item: times: map (const item) (range 1 times);
|
||||
|
||||
# [Bool] -> Bool
|
||||
any' = any (boolean: boolean);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
{ stdlib, lists }:
|
||||
{ stdlib }:
|
||||
let
|
||||
inherit (stdlib.lists) length;
|
||||
inherit (lists) repeat;
|
||||
inherit (stdlib.lists) length replicate;
|
||||
inherit (stdlib.strings) concatStringsSep replaceStrings splitString;
|
||||
in rec {
|
||||
# String -> [String]
|
||||
@ -15,13 +14,13 @@ in rec {
|
||||
mapLines = splitMap "\n";
|
||||
|
||||
# String -> Int -> String
|
||||
repeatString = string: times: concatStringsSep "" (repeat string times);
|
||||
repeatString = string: times: concatStringsSep "" (replicate times string);
|
||||
|
||||
# Replaces any occurences in a list of strings with a single replacement.
|
||||
# NOTE: This function does not support regex patterns.
|
||||
#
|
||||
# [String] -> String -> String -> String
|
||||
replaceStrings' = from: to: replaceStrings from (repeat to (length from));
|
||||
replaceStrings' = from: to: replaceStrings from (replicate (length from) to);
|
||||
|
||||
# [String] -> String
|
||||
unlines = concatStringsSep "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user