add eq? function
This commit is contained in:
parent
b10ef13ca0
commit
207ec5bd24
16
src/bool.c
16
src/bool.c
|
@ -17,3 +17,19 @@ pic_eq_p(pic_state *pic, pic_value x, pic_value y)
|
||||||
return false;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "picrin.h"
|
#include "picrin.h"
|
||||||
#include "picrin/pair.h"
|
#include "picrin/pair.h"
|
||||||
|
|
||||||
|
void pic_init_bool(pic_state *);
|
||||||
void pic_init_pair(pic_state *);
|
void pic_init_pair(pic_state *);
|
||||||
void pic_init_port(pic_state *);
|
void pic_init_port(pic_state *);
|
||||||
void pic_init_number(pic_state *);
|
void pic_init_number(pic_state *);
|
||||||
|
@ -65,6 +66,7 @@ pic_init_core(pic_state *pic)
|
||||||
int ai;
|
int ai;
|
||||||
|
|
||||||
ai = pic_gc_arena_preserve(pic);
|
ai = pic_gc_arena_preserve(pic);
|
||||||
|
pic_init_bool(pic); DONE;
|
||||||
pic_init_pair(pic); DONE;
|
pic_init_pair(pic); DONE;
|
||||||
pic_init_port(pic); DONE;
|
pic_init_port(pic); DONE;
|
||||||
pic_init_number(pic); DONE;
|
pic_init_number(pic); DONE;
|
||||||
|
|
|
@ -115,9 +115,9 @@ repl(pic_state *pic)
|
||||||
v = pic_car(pic, vs);
|
v = pic_car(pic, vs);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
printf("[read: ");
|
printf("[read: ");
|
||||||
pic_debug(pic, v);
|
pic_debug(pic, v);
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* eval */
|
/* eval */
|
||||||
|
|
Loading…
Reference in New Issue