From e7bc12a93265dce5704be7024e9dbac4f6ec07ae Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Sun, 10 Feb 2008 17:38:56 +0000 Subject: [PATCH] * Function concatMap as in Haskell. svn path=/nixpkgs/branches/stdenv-updates/; revision=10588 --- pkgs/lib/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 1018d9609078..0d22070ee98d 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -52,6 +52,10 @@ rec { fold (x: y: x + y) ""; + # Map and concatenate the result. + concatMap = f: list: concatLists (map f list); + + # Place an element between each element of a list, e.g., # `intersperse "," ["a" "b" "c"]' returns ["a" "," "b" "," "c"]. intersperse = separator: list: