From 9b31e5bd2f2a006350d66536ce5a8c5f379fea01 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 2 Feb 2014 21:16:45 +0900 Subject: [PATCH] refactor list_by_array --- src/pair.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pair.c b/src/pair.c index ffea835e..80ac57a4 100644 --- a/src/pair.c +++ b/src/pair.c @@ -83,13 +83,12 @@ pic_value pic_list_by_array(pic_state *pic, size_t c, pic_value *vs) { pic_value v; - size_t i; v = pic_nil_value(); - for (i = 0; i < c; ++i) { - v = pic_cons(pic, vs[i], v); + while (c--) { + v = pic_cons(pic, vs[c], v); } - return pic_reverse(pic, v); + return v; } pic_value