commit a7be1dacf85541a4bdf0135d6b1252f03b9e19fb
parent 1290b026a13b93fb75706c0b46b7b3af619d071c
Author: Andres Navarro <canavarro82@gmail.com>
Date: Thu, 24 Mar 2011 00:08:20 -0300
Added not? to the ground environment.
Diffstat:
4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/kgbooleans.c b/src/kgbooleans.c
@@ -20,3 +20,15 @@
/* 4.1.1 boolean? */
/* uses typep */
+
+/* 6.1.1 not? */
+void notp(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
+{
+ UNUSED(xparams);
+ UNUSED(denv);
+
+ bind_1tp(K, "not?", ptree, "boolean", ttisboolean, tv_b);
+
+ TValue res = kis_true(tv_b)? KFALSE : KTRUE;
+ kapply_cc(K, res);
+}
diff --git a/src/kgbooleans.h b/src/kgbooleans.h
@@ -21,4 +21,7 @@
/* 4.1.1 boolean? */
/* uses typep */
+/* 6.1.1 not? */
+void notp(klisp_State *K, TValue *xparams, TValue ptree, TValue denv);
+
#endif
diff --git a/src/kgports.c b/src/kgports.c
@@ -337,6 +337,7 @@ TValue make_guarded_read_cont(klisp_State *K, TValue parent, TValue port)
any error during reading, close the file and return that error.
This is consistent with the report description of the load-module
applicative.
+ ASK John: maybe we should return the result of the last expression.
*/
void load(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
{
diff --git a/src/kground.c b/src/kground.c
@@ -349,7 +349,7 @@ void kinit_ground_env(klisp_State *K)
*/
/* 6.1.1 not? */
- /* TODO */
+ add_applicative(K, ground_env, "not?", notp, 0);
/* 6.1.2 and? */
/* TODO */