1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 18:12:46 +00:00
Commit graph

27 commits

Author SHA1 Message Date
Shea Levy 8a66c8b8f8 imap previously mapped with 1-based indices
Why????

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-12 13:06:32 -04:00
Shea Levy a4c333474c lib/lists.nix: Remove uses of the tail function
nix lists are not like haskell lists, and tail is an O(n) operation.
This makes recursion using tail less efficient than recursion using
length + elemAt.

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-12 12:36:36 -04:00
Eelco Dolstra 79eda8573e Remove broken ‘removeList’ function 2013-03-26 11:58:59 +01:00
Shea Levy da3be9c6b2 Add deepSeq lib function 2013-02-01 00:39:26 -05:00
Marc Weber 1a948d97a2 fix sort in lists.nix 2012-11-20 13:56:14 +01:00
Eelco Dolstra 9d516f16fc Fix evaluation problem
http://hydra.nixos.org/build/2940128
2012-08-14 13:42:43 -04:00
Eelco Dolstra 4f7917ac62 Remove obsolete flattenAttrs function 2012-08-13 18:26:19 -04:00
Eelco Dolstra 8225460f82 Remove obsolete eqLists function 2012-08-13 18:19:06 -04:00
Eelco Dolstra c68c95d55a Provide O(n) time implementations of fold/foldl/any/all
Previous implementations were O(n^2) because tail takes O(n) time.
2012-08-13 15:15:16 -04:00
Eelco Dolstra c0a483632c Eliminate some calls to ‘tail’ 2012-08-13 15:15:16 -04:00
Eelco Dolstra 431c55cbf1 Use builtin filter, elem, concatLists functions if available 2012-08-13 15:15:16 -04:00
Eelco Dolstra e78a048265 * Add a function "filterAttrs" and clean up some comments.
svn path=/nixpkgs/trunk/; revision=33626
2012-04-05 15:37:52 +00:00
Shea Levy 4d70ba6cc9 Merge from trunk up through r28790
svn path=/nixpkgs/branches/stdenv-updates/; revision=28792
2011-08-24 19:16:43 +00:00
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
Yury G. Kudryashov 3e71355377 Add two 'remove' functions
svn path=/nixpkgs/branches/stdenv-updates/; revision=26311
2011-03-15 09:24:47 +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