[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] fixes to tailp and nconc
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] fixes to tailp and nconc |
Date: |
27 Jan 2003 15:36:39 -0500 |
Greetings! Thanks for the report -- should be fixed now.
Take care,
Peter Wood <address@hidden> writes:
> --VbJkn9YxBvnuCH5J
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> Hi
>
> nconc can take a dotted list. This means GCL is in error here:
>
> (nconc '(a . b) 'c) ==> signals an error saying 'b is not a list.--
> should be '(a . c)
>
> Also tailp must return T for nil and a proper list. GCL is doing this:
>
> (tailp nil '(a b c)) ; ==> nil -- should be T
>
> I can't submit a diff, since my list.d also contains other changes,
> but I think this is the relevant code (attached).
>
> Regards,
> Peter
> --VbJkn9YxBvnuCH5J
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="list.d-fix.c"
>
>
> object
> nconc(object x, object y) {
> object x1;
>
> if (endp(x))
> return(y);
> for (x1 = x; type_of(x1->c.c_cdr)==t_cons; x1 = x1->c.c_cdr)
> ;
> x1->c.c_cdr = y;
> return(x);
> }
>
> void
> Lnconc() {
> object x, l, m=Cnil;
> int i, narg;
>
> narg = vs_top - vs_base - 1;
> if (narg < 0) { vs_push(Cnil); return; }
> x = Cnil;
> for (i = 0; i < narg; i++) {
> l = vs_base[i];
> if (type_of(l) != t_cons)
> continue;
> if (x == Cnil)
> x = m = l;
> else {
> m->c.c_cdr = l;
> m = l;
> }
> for (; (type_of(m->c.c_cdr)==t_cons) ; m = m->c.c_cdr)
> ;
> }
> if (x == Cnil) vs_base[0] = vs_top[-1];
> else {
> m->c.c_cdr = vs_top[-1];
> vs_base[0] = x;
> }
> vs_top = vs_base+1;
> }
>
> void
> Ltailp() {
> object x;
>
> check_arg(2);
> for (x = vs_base[1]; !endp(x); x = x->c.c_cdr)
> /* if (dot_list_eq(x,vs_base[0])) {*/
> if (eql(fix_dot(x),vs_base[0])) {
> vs_base[0] = Ct;
> vs_popp;
> return;
> }
> if (vs_base[0] == Cnil && x == Cnil)
> vs_base[0] = Ct;
> else
> vs_base[0] = Cnil;
> vs_popp;
> return;
> }
>
> --VbJkn9YxBvnuCH5J
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
>
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
>
> --VbJkn9YxBvnuCH5J--
>
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah