Commit graph

13 commits

Author SHA1 Message Date
Nicolas Pierron
85d3fd3e3c lists: Add imap function to iterate over a list with the index of each
element.

svn path=/nixpkgs/trunk/; revision=27013
2011-04-27 18:41:34 +00:00
Nicolas Pierron
781770eaa9 fix zipListsWith function: use it-self for the recursion.
svn path=/nixpkgs/trunk/; revision=27012
2011-04-27 18:41:31 +00:00
Sander van der Burg
1e9dc2b254 It seems that lib.zip is already taken from attributesets, therefore renaming it to zipTwoLists
svn path=/nixpkgs/trunk/; revision=22887
2010-08-02 16:48:19 +00:00
Sander van der Burg
beee6e5e1d Moved 'zip' function from nixos/lib/build-vms.nix
svn path=/nixpkgs/trunk/; revision=22882
2010-08-02 16:10:01 +00:00
Marc Weber
9e59164e57 adding lib function haskell's drop x elements from head of list
svn path=/nixpkgs/trunk/; revision=21141
2010-04-17 18:26:40 +00:00
Nicolas Pierron
d311b4e98f * Add a function to take the last element of a list.
svn path=/nixpkgs/trunk/; revision=19179
2010-01-03 11:05:42 +00:00
Marc Weber
7ef915ebc8 nixpkgs lib: adding haskell's take
svn path=/nixpkgs/trunk/; revision=18848
2009-12-08 21:47:14 +00:00
Nicolas Pierron
bb077b253f * Add a function to sort a list.
* Add a new property to order NixOS definitions without creating
  dependencies between snippets.
* Add mkHeader & mkFooter properties (special case of mkOrder).

svn path=/nixpkgs/trunk/; revision=18242
2009-11-07 01:59:55 +00:00
Nicolas Pierron
e528b920bb Add the reverseList function.
svn path=/nixpkgs/trunk/; revision=17676
2009-10-06 13:36:46 +00:00
Nicolas Pierron
e6399964cb Add the zipLists and zipListsWith functions.
svn path=/nixpkgs/trunk/; revision=17476
2009-09-28 18:22:14 +00:00
Eelco Dolstra
9f59fb9377 * findFirst is used by the LaTeX function. Forgot to commit.
svn path=/nixpkgs/trunk/; revision=16438
2009-07-22 14:43:39 +00:00
Eelco Dolstra
6408a6a6fd * Trivial function to create a singleton list. Can reduce unnecessary
indentation in expressions like

    environent.extraJobs =
      [ { name = "foo";
          job =
            ''
              bla bla
            '';
        }
      ];

  which becomes

    environent.extraJobs = singleton
      { name = "foo";
        job =
          ''
            bla bla
          '';
      };

svn path=/nixpkgs/trunk/; revision=15892
2009-06-08 22:42:42 +00:00
Eelco Dolstra
599015e8b0 * Split lib/default.nix into several files, as it had become a big
mess.  Also cleaned up some functions:

  - foldl appeared broken (it recursively called fold).
  - Renamed logicalAND/logicalOR to and/or.
  - Removed listOfListsToAttrs, eqStrings: obsolete.
  - Removed isInList, which does the same thing as elem.
  - stringToCharacters: don't return a "" at the end of the list.
  - Renamed concatList to concat, as concatList (singular) is a
    misnomer: it takes two lists.  Likewise, renamed mergeAttr to
    mergeAttrs.

  misc.nix still contains a lot of stuff that should be refactored and
  moved to other files.

svn path=/nixpkgs/trunk/; revision=14013
2009-02-09 16:51:03 +00:00