mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-16 23:27:17 +02:00
![Eelco Dolstra](/assets/img/avatar_default.png)
list. Useful for lots of things, such as implementing a fold function (see NIX-30, example is in tests/lang/eval-okay-list.nix).
13 lines
No EOL
221 B
Nix
13 lines
No EOL
221 B
Nix
let {
|
|
|
|
fold = op: nul: list:
|
|
if list == []
|
|
then nul
|
|
else op (builtins.head list) (fold op nul (builtins.tail list));
|
|
|
|
concat =
|
|
fold (x: y: x + y) "";
|
|
|
|
body = concat ["foo" "bar" "bla" "test"];
|
|
|
|
} |