Re: 3.99.2 problems

From: Ian Wild <ian.wild_at_eurocontrol.be>
Date: Mon, 06 Jul 1998 09:34:34 +0200

Andrew Dorrell wrote:
>
> Have been playing with 3.99.2 and it is giving me some problems.
> So far I have:
>
> 1. set-cdr! misbehaves:
>
> thomas:~> stk-3.1.1
> Welcome to the STk interpreter version 3.1.1 [Linux-2.X-ix86]
> Copyright © 1993-1996 Erick Gallesio - I3S - CNRS / ESSI <eg_at_unice.fr>
> STk> (let ((l '((a b) (c d)))
> )
> (set-cdr! (car l) 'z)
> l)
> ((a . z) (c d))
>
> thomas:~/doc/mammo/reports/monitors> stk-3.99.2
> Welcome to the STk interpreter version 3.99.2 [Linux-2.X-ix86]
> Copyright © 1993-1998 Erick Gallesio - I3S - CNRS / ESSI <eg_at_unice.fr>
> STk> (let ((l '((a b) (c d)))
> )
> (set-cdr! (car l) 'z)
> l)
> ((a ((a . z) (c d))

I've been playing with this over the weekend. It turns out
that set-cdr! is working as expected, but the top level REPL
can't print dotted pairs! Just try '(a . b), for example.

This seems to be a bug in the "print circular" code, possibly
in print.c/printlist_star(). I can't say I understand the code
well enough to be sure this won't break it further but, on my home
machine, the following patch makes the problem go away:

diff -u orig/print.c new/print.c
--- orig/print.c
+++ new/print.c
_at_@ -427,9 +440,8 @@
 
     if (NULLP(exp=CDR(exp))) break;
 
- if ((tmp = STk_assv(exp, cycles)) != Ntruth) {
- value = CDR(tmp);
- if (NCONSP(exp) || value == Truth || INTEGERP(value)) {
+ if (NCONSP(exp) || (tmp = STk_assv(exp, cycles)) != Ntruth) {
+ if (NCONSP(exp) || (value = CDR(tmp)) == Truth || INTEGERP(value)) {
        /* either ". X" or ". #0=(...)" or ". #0#" */
        Puts(" . ", f);
        print_cycle(exp, port);


(BTW - don't trust the line numbers too much. I've made
other changes to that same file.)

(I mailed myself that patch hoping to apply it here at work,
only to discover I I haven't yet installed 3.99.2 here!)

ian
Received on Mon Jul 06 1998 - 09:34:27 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST