diff options
author | Teddy <[email protected]> | 2013-08-09 20:28:37 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-08-09 20:28:37 +0800 |
commit | ed541c0d83caff9e417a89bc4e6ae83ea22eb214 (patch) | |
tree | 3c8998067286bf966fa8de1ce9e19669daf8a2fd /builtin.cpp | |
parent | db59e90e97adaacf758bbd5f4cd86ed9b30262d6 (diff) |
bugfix on `lt` `gt` `eq`, added `number?`
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin.cpp b/builtin.cpp index 94fcd9b..a8091ba 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1028,6 +1028,7 @@ BUILTIN_PROC_DEF(num_lt) { throw TokenError("a number", RUN_ERR_WRONG_TYPE); NumObj *last = static_cast<NumObj*>(args->car), *opr; + args = TO_PAIR(args->cdr); for (; args != empty_list; args = TO_PAIR(args->cdr), last = opr) { if (!args->car->is_num_obj()) // not a number @@ -1052,6 +1053,7 @@ BUILTIN_PROC_DEF(num_gt) { throw TokenError("a number", RUN_ERR_WRONG_TYPE); NumObj *last = static_cast<NumObj*>(args->car), *opr; + args = TO_PAIR(args->cdr); for (; args != empty_list; args = TO_PAIR(args->cdr), last = opr) { if (!args->car->is_num_obj()) // not a number @@ -1076,6 +1078,7 @@ BUILTIN_PROC_DEF(num_eq) { throw TokenError("a number", RUN_ERR_WRONG_TYPE); NumObj *last = static_cast<NumObj*>(args->car), *opr; + args = TO_PAIR(args->cdr); for (; args != empty_list; args = TO_PAIR(args->cdr), last = opr) { if (!args->car->is_num_obj()) // not a number @@ -1417,6 +1420,11 @@ do { \ return new BoolObj(true); } +BUILTIN_PROC_DEF(is_number) { + ARGS_EXACTLY_ONE; + return new BoolObj(args->car->is_num_obj()); +} + BUILTIN_PROC_DEF(display) { ARGS_EXACTLY_ONE; printf("%s\n", args->car->ext_repr().c_str()); |