apply' argument treatment was broken

This commit is contained in:
Yuichi Nishiwaki 2014-02-04 14:33:36 +09:00
parent 96fc08dd0b
commit 2ed2b503a6
1 changed files with 6 additions and 3 deletions

View File

@ -86,7 +86,7 @@ static pic_value
pic_proc_apply(pic_state *pic)
{
struct pic_proc *proc;
pic_value *args;
pic_value *args, arg_list;
size_t argc;
pic_get_args(pic, "l*", &proc, &argc, &args);
@ -94,8 +94,11 @@ pic_proc_apply(pic_state *pic)
if (argc == 0) {
pic_error(pic, "apply: wrong number of arguments");
}
return pic_apply(pic, proc, pic_list_by_array(pic, argc, args));
arg_list = args[--argc];
while (argc--) {
arg_list = pic_cons(pic, args[argc], arg_list);
}
return pic_apply(pic, proc, arg_list);
}
static pic_value