From 81d5a9e5241eeb9ebcbb78afe82fba0ae8001f6e Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sun, 19 Jun 2016 22:55:23 -0400 Subject: [PATCH] Issue #10 - Add vector support to (write). --- runtime.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runtime.c b/runtime.c index 0ba26b8c..37663352 100644 --- a/runtime.c +++ b/runtime.c @@ -773,6 +773,16 @@ static object _Cyc_write(object x, FILE * port) fprintf(port, "\"%s\"", ((string_type *) x)->str); break; // TODO: what about a list? contents should be displayed per (write) + case vector_tag: + fprintf(port, "#("); + for (i = 0; i < ((vector) x)->num_elements; i++) { + if (i > 0) { + fprintf(port, " "); + } + _Cyc_write(((vector) x)->elements[i], port); + } + fprintf(port, ")"); + break; case pair_tag: has_cycle = Cyc_has_cycle(x); fprintf(port, "(");