c02a44183f
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
221 B
Nix
13 lines
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"];
|
|
|
|
} |