From c7829122123f9f6385b59b26172567291a513bad Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 25 Oct 2013 00:37:08 +0900 Subject: [PATCH] add pair? --- src/pair.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pair.c b/src/pair.c index 072cb97e..2f522891 100644 --- a/src/pair.c +++ b/src/pair.c @@ -115,6 +115,16 @@ pic_acons(pic_state *pic, pic_value key, pic_value val, pic_value assoc) return pic_cons(pic, pic_cons(pic, key, val), assoc); } +static pic_value +pic_pair_pair_p(pic_state *pic) +{ + pic_value v; + + pic_get_args(pic, "o", &v); + + return pic_bool_value(pic_pair_p(v)); +} + static pic_value pic_pair_set_car(pic_state *pic) { @@ -146,6 +156,7 @@ pic_pair_set_cdr(pic_state *pic) void pic_init_pair(pic_state *pic) { + pic_defun(pic, "pair?", pic_pair_pair_p); pic_defun(pic, "set-car!", pic_pair_set_car); pic_defun(pic, "set-cdr!", pic_pair_set_cdr); }