From 2cabb50a38aa6d5cb16f726017b0f7a277dd499b Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Wed, 28 Jan 2026 13:51:51 +1000 Subject: [PATCH] add not fn --- nt/primitives/std/prim/fn.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nt/primitives/std/prim/fn.nix b/nt/primitives/std/prim/fn.nix index 2ac65e6..98ebb14 100644 --- a/nt/primitives/std/prim/fn.nix +++ b/nt/primitives/std/prim/fn.nix @@ -1,4 +1,9 @@ -{...}: { +{...}: let + inherit + (builtins) + isFunction + ; +in rec { id = x: x; # syntactic sugar for curry flipping @@ -15,4 +20,10 @@ if x != null then f x else x; + + not = f: + if isFunction f + then x: not (f x) + # WARNING: assume isBool holds (or fail) + else ! f; }