diff --git a/module/mes/display.mes b/module/mes/display.mes index 51c70c77..1dcbc4b2 100644 --- a/module/mes/display.mes +++ b/module/mes/display.mes @@ -99,17 +99,17 @@ ((pair? x) (if (not cont?) (write-char #\( port)) (cond ((eq? (car x) '*circular*) - (display "(*circ* . #-1#)" port)) + (display "*circ* . #-1#)" port)) ((eq? (car x) '*closure*) - (display "(*closure* . #-1#)" port)) + (display "*closure* . #-1#)" port)) (#t (display (car x) port write?) (if (pair? (cdr x)) (d (cdr x) #t " ") (if (and (cdr x) (not (null? (cdr x)))) (begin (display " . " port) - (display (cdr x) port write?)))) - (if (not cont?) (write-char #\) port))))) + (display (cdr x) port write?)))))) + (if (not cont?) (write-char #\) port))) ((or (keyword? x) (special? x) (string? x) (symbol? x)) (if (and (string? x) write?) (write-char #\" port)) (if (keyword? x) (display "#:" port)) diff --git a/src/lib.c b/src/lib.c index 31916200..0ecbcc61 100644 --- a/src/lib.c +++ b/src/lib.c @@ -38,6 +38,13 @@ display_helper (SCM x, int cont, char* sep, int fd) fputc (VALUE (x), fd); break; } + case TCLOSURE: + { + fputs ("#", fd); + break; + } case TFUNCTION: { fputs ("#", fd); break; } @@ -67,14 +74,19 @@ display_helper (SCM x, int cont, char* sep, int fd) case TPAIR: { if (!cont) fputs ("(", fd); - if (x && x != cell_nil) fdisplay_ (CAR (x), fd); - if (CDR (x) && TYPE (CDR (x)) == TPAIR) - display_helper (CDR (x), 1, " ", fd); - else if (CDR (x) && CDR (x) != cell_nil) + if (CAR (x) == cell_circular) + fputs ("*circ* . #-1#", fd); + else { - if (TYPE (CDR (x)) != TPAIR) - fputs (" . ", fd); - fdisplay_ (CDR (x), fd); + if (x && x != cell_nil) fdisplay_ (CAR (x), fd); + if (CDR (x) && TYPE (CDR (x)) == TPAIR) + display_helper (CDR (x), 1, " ", fd); + else if (CDR (x) && CDR (x) != cell_nil) + { + if (TYPE (CDR (x)) != TPAIR) + fputs (" . ", fd); + fdisplay_ (CDR (x), fd); + } } if (!cont) fputs (")", fd); break;