chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Question regarding "length"


From: Kon Lovett
Subject: Re: [Chicken-users] Question regarding "length"
Date: Mon, 29 May 2006 14:14:56 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On May 29, 2006, at 1:51 PM, Abdulaziz Ghuloum wrote:

Greetings,

I sent this question to the list last week but it complained about me
not being a subscriber.  I'll assume it did not get through, so here
it is again:

Looking at the definition of length in chicken, I noticed that it
detects neither circularities nor improper lists.  For example:
(length '(1 2 . 3)) => 2
and
(length (let ((x (cons 1 2))) (set-cdr! x x) x)) => infinite loop.

I'm wondering if this is a bug, or a design decision.  And if it
is by design (my guess), I would like to know the rationale behind it.

Speed probably. I don't think R5RS specifies behavior for improper or circular lists. Use SRFI-1 length+, proper-list?, circular-list?, etc.

What is the list length of (1 . 2) anyway? Only 1 makes sense.


Thanks.

Aziz,,,



_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFEe2RQJJNoeGe+5O4RAqhtAJ4/r0OqdmIN8x8KO0GCRuhvmFR9egCeM7wR
qoBpqWgmujI+ANLuqT+G0IQ=
=w+7F
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]