add coalesce

This commit is contained in:
James Andariese 2022-10-17 10:41:57 -05:00
parent 48f393a2d6
commit 4d0a87386e

7
coalesce.nix Normal file
View File

@ -0,0 +1,7 @@
with builtins;
let fn = y: vs:
if vs == [] then null else
if head vs != null then head vs else
y y (tail vs);
in
fn fn