On Mon, Apr 7, 2008 at 3:24 PM, Alex Rozenshteyn <[EMAIL PROTECTED]> wrote: > (define a (list 'a)) > (set-cdr! a a) > ;a is now a cyclic "list" > (pair? a) ; -> #t > (list? a) ; -> #f > (length a) > > and now the interpreter gets stuck. > control-c does not break (this is because I have the readline egg > installed). > > > I have two questions: > 1) How do I get C-c to break? > 2) Is the interpreter supposed to freeze if length is passed a cyclic list?
Yes, it's correct. See length and length+ in SRFI-1: http://srfi.schemers.org/srfi-1/srfi-1.html#Miscellaneous length+ will give you sane behaviour with cyclic lists. > Other scheme implementations generate an error. Yes, but that's implementation-specifc. (length) may "diverge or signal an error" according to SRFI-1, and in Chicken's case it diverges. Graham _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users