From 1c2af96340f026681b0391ad2383ee65155af341 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 21 Sep 2014 16:26:56 +0900 Subject: [PATCH] remove dictionary-map and dictionary-for-each --- dict.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/dict.c b/dict.c index 229b55ad..0746fbd9 100644 --- a/dict.c +++ b/dict.c @@ -216,46 +216,6 @@ pic_dict_dictionary_size(pic_state *pic) return pic_int_value(pic_dict_size(pic, dict)); } -static pic_value -pic_dict_dictionary_map(pic_state *pic) -{ - struct pic_proc *proc; - struct pic_dict *dict; - pic_value item, list = pic_nil_value(); - xh_entry *it; - - pic_get_args(pic, "ld", &proc, &dict); - - for (it = xh_begin(&dict->hash); it != NULL; it = xh_next(it)) { - item = pic_cons(pic, xh_key(it, pic_value), xh_val(it, pic_value)); - pic_push(pic, pic_apply1(pic, proc, item), list); - } - - return pic_reverse(pic, list); -} - -static pic_value -pic_dict_dictionary_for_each(pic_state *pic) -{ - struct pic_proc *proc; - struct pic_dict *dict; - pic_value item; - xh_entry *it; - - pic_get_args(pic, "ld", &proc, &dict); - - for (it = xh_begin(&dict->hash); it != NULL; it = xh_next(it)) { - int ai = pic_gc_arena_preserve(pic); - - item = pic_cons(pic, xh_key(it, pic_value), xh_val(it, pic_value)); - pic_apply1(pic, proc, item); - - pic_gc_arena_restore(pic, ai); - } - - return pic_none_value(); -} - static pic_value pic_dict_dictionary_to_alist(pic_state *pic) { @@ -334,8 +294,6 @@ pic_init_dict(pic_state *pic) pic_defun(pic, "dictionary-set!", pic_dict_dictionary_set); pic_defun(pic, "dictionary-delete!", pic_dict_dictionary_del); pic_defun(pic, "dictionary-size", pic_dict_dictionary_size); - pic_defun(pic, "dictionary-map", pic_dict_dictionary_map); - pic_defun(pic, "dictionary-for-each", pic_dict_dictionary_for_each); pic_defun(pic, "dictionary->alist", pic_dict_dictionary_to_alist); pic_defun(pic, "alist->dictionary", pic_dict_alist_to_dictionary); pic_defun(pic, "dictionary->plist", pic_dict_dictionary_to_plist);