From 9c0ba1801aa21d76f2daec4fb42649ebb5e654a4 Mon Sep 17 00:00:00 2001 From: cynic Date: Sun, 23 Oct 2022 22:14:02 -0400 Subject: [PATCH] move inv into the standard library --- lib.py | 2 -- lib/booleans.klambda | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib.py b/lib.py index 8c1c937..02e48f5 100644 --- a/lib.py +++ b/lib.py @@ -80,8 +80,6 @@ def execute(program): return reduce(lambda a, b: (a[0], a[1]/b[1]), subs[1:]) elif ctx[0] == _ident("%"): return (subs[1][0], subs[1][1]%subs[2][1]) - elif ctx[0] == _ident("!"): - return ("number", 0.0 if _truthy(subs[1]) else 1.0) elif ctx[0] == _ident("=="): return ("number", 1.0 if subs[1] == subs[2] else 0.0) elif ctx[0] == _ident("="): diff --git a/lib/booleans.klambda b/lib/booleans.klambda index 6b50584..d85f417 100644 --- a/lib/booleans.klambda +++ b/lib/booleans.klambda @@ -1,2 +1,7 @@ (def true 1) -(def false 0) \ No newline at end of file +(def false 0) + +(def ! (lambda (val) + (cond (val) + 0 + 1))) \ No newline at end of file