diff --git a/src/env.c b/src/env.c index ed0dcf8..7851eed 100644 --- a/src/env.c +++ b/src/env.c @@ -229,7 +229,7 @@ struct Environment defaultEnv() {"cat", &catObjects}, {"fil", &filter}, {"len", &len}, {"ap", &append}, {"pre", &prepend}, {"at", &at}, {"rest", &rest}, {"rev", &reverse}, - {"isnum", &isNum}, + {"isnum", &isNum}, {"isstr", &isString}, {"prn", &print}, {"penv", &printEnvO}, }; diff --git a/src/pebblisp.c b/src/pebblisp.c index dbf09fe..ff53fe3 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -392,6 +392,12 @@ Object isNum(Object test, Object ignore, struct Environment *ignore2) boolObject(1) : boolObject(0); } +Object isString(Object test, Object ignore, struct Environment *ignore2) +{ + return test.type == TYPE_STRING ? + boolObject(1) : boolObject(0); +} + Object print(Object p, Object ignore, struct Environment *env) { p = cloneObject(p); diff --git a/src/pebblisp.h b/src/pebblisp.h index e128ac7..4d93924 100644 --- a/src/pebblisp.h +++ b/src/pebblisp.h @@ -56,6 +56,7 @@ Object rest(Object list, Object ignore, struct Environment *env); Object reverse(Object _list, Object ignore, struct Environment *ignore2); Object isNum(Object test, Object ignore, struct Environment *ignore2); +Object isString(Object test, Object ignore, struct Environment *ignore2); Object print(Object p, Object ignore, struct Environment *ignore2); Object printEnvO(Object i1, Object i2, struct Environment *env);