add eq? function

This commit is contained in:
Yuichi Nishiwaki 2013-10-31 00:29:55 +09:00
parent b10ef13ca0
commit 207ec5bd24
3 changed files with 21 additions and 3 deletions

View File

@ -17,3 +17,19 @@ pic_eq_p(pic_state *pic, pic_value x, pic_value y)
return false;
}
}
static pic_value
pic_bool_eq_p(pic_state *pic)
{
pic_value x, y;
pic_get_args(pic, "oo", &x, &y);
return pic_bool_value(pic_eq_p(pic, x, y));
}
void
pic_init_bool(pic_state *pic)
{
pic_defun(pic, "eq?", pic_bool_eq_p);
}

View File

@ -4,6 +4,7 @@
#include "picrin.h"
#include "picrin/pair.h"
void pic_init_bool(pic_state *);
void pic_init_pair(pic_state *);
void pic_init_port(pic_state *);
void pic_init_number(pic_state *);
@ -65,6 +66,7 @@ pic_init_core(pic_state *pic)
int ai;
ai = pic_gc_arena_preserve(pic);
pic_init_bool(pic); DONE;
pic_init_pair(pic); DONE;
pic_init_port(pic); DONE;
pic_init_number(pic); DONE;

View File

@ -115,9 +115,9 @@ repl(pic_state *pic)
v = pic_car(pic, vs);
#if DEBUG
printf("[read: ");
pic_debug(pic, v);
printf("]\n");
printf("[read: ");
pic_debug(pic, v);
printf("]\n");
#endif
/* eval */