commit ce8bce5979e28ae3c2267834b4528d95177c7607
parent 9c7a803586fd259ad5f0311a835ca2a484c94176
Author: Andres Navarro <canavarro82@gmail.com>
Date: Thu, 24 Mar 2011 20:44:24 -0300
Refactor: ftyped_predp now uses check_list.
Diffstat:
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/kghelpers.c b/src/kghelpers.c
@@ -93,22 +93,10 @@ void ftyped_predp(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
/* check the ptree is a list first to allow the structure
errors to take precedence over the type errors. */
+ int32_t cpairs;
+ int32_t pairs = check_list(K, name, true, ptree, &cpairs);
TValue tail = ptree;
- int32_t pairs = 0;
- while(ttispair(tail) && kis_unmarked(tail)) {
- pairs++;
- kmark(tail);
- tail = kcdr(tail);
- }
- unmark_list(K, ptree);
-
- if (!ttispair(tail) && !ttisnil(tail)) {
- klispE_throw_extra(K, name, ": expected list");
- return;
- }
-
- tail = ptree;
bool res = true;
/* check the type while checking the predicate.