On Feb 18, 2008 8:14 PM, David Brown <[EMAIL PROTECTED]> wrote: > Another example is that Python lists can't represent circular data > structures, which Scheme/lisp lists can. In other words, you can't > implement set-cdr! without using cons cells.
Your other comments seem correct, but can you expand on this last part? Python lists hold references and can refer to themselves: >>> from pprint import pprint >>> t = [1, 2] >>> t = [t, t] >>> pprint(t) [[1, 2], [1, 2]] >>> t[0] is t[1] True >>> t[1] is t False >>> t[1] = t >>> t[1] is t True >>> pprint(t) [[1, 2], <Recursion on list with id=405832>] Well that wasn't a minimal session to demonstrate the concept, but nonetheless we end up with a list t that is effectively [[1, 2], t] Did you mean something else by circular or did you mean that LISP had a more elegant way of constructing the cycle? (or something else...) -Chuck -- http://cobra-language.com/ -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
