From 48c5c6b17c16efb4b489bde0ab8e41ee0e2b1bc6 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 14 Nov 2013 16:57:07 +0900 Subject: [PATCH] add vector-set! --- src/vector.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vector.c b/src/vector.c index 84da5297..6bc729db 100644 --- a/src/vector.c +++ b/src/vector.c @@ -77,6 +77,19 @@ pic_vec_vector_ref(pic_state *pic) return v->data[k]; } +static pic_value +pic_vec_vector_set(pic_state *pic) +{ + struct pic_vector *v; + int k; + pic_value o; + + pic_get_args(pic, "vio", &v, &k, &o); + + v->data[k] = o; + return pic_false_value(); +} + void pic_init_vector(pic_state *pic) { @@ -84,4 +97,5 @@ pic_init_vector(pic_state *pic) pic_defun(pic, "make-vector", pic_vec_make_vector); pic_defun(pic, "vector-length", pic_vec_vector_length); pic_defun(pic, "vector-ref", pic_vec_vector_ref); + pic_defun(pic, "vector-set!", pic_vec_vector_set); }