Can't Find List Command Details While Learning Nix

I’m working my way through an online Nix Language tutorial at NixCloud.io

Below is an example of Lesson 20 of 34

Examples #9, #10 and #11 (commented out) involve the take, drop and unique commands for Nix lists, but when I search the online Nix docs I can find nothing about the commands nor examples on how to use them. I’ve been able to correctly infer the operation of most the commands through trial and error, but these last three commands have eluded me.

Do online docs exist somewhere that describe these commands, or is the tutorial perhaps using a version of Nix where these commands have been deprecated?


with import <nixpkgs> { };
with stdenv.lib;
let
  list = [2 "4" true true {a = 27;} 2];
  f = x: isString x;
  s = "foobar";
in
{
  #replace all X, everything should evaluate to true
  ex00 = isList list;
  ex01 = elemAt list 2 == true;
  ex02 = length list == 6;
  ex03 = last list == 2;
  ex04 = filter f list == [ "4" ];
  ex05 = head list == 2;
  ex06 = tail list == ["4" true true {a = 27;} 2];
  ex07 = remove true list == [ 2 "4" {a = 27;} 2 ];
  ex08 = toList s == [ "foobar" ];
  #ex09 = take 3 list == [ XXX];
  #ex10 = drop 4 list == [XXXX ];
  #ex11 = unique list == [ XXX ];
  ex12 = list ++ ["x" "y"] == [ 2 "4" true true {a = 27;} 2 "x" "y" ];
}

with stdenv.lib pulls all of the identifiers at the top level of lib into context–most relevantly in your case these list operations:

These aren’t Nix builtins, so the documentation for them is in the Nixpkgs manual:

Edit: Also, you can get better code formatting that’ll be easier for everyone to read by wrapping the code in 3 backticks and indicating the format on the first line, like below:

```nix
<code...>
```