Shmuel (Seymour J.) Metz <spamt...@library.lspace.org.invalid> writes:
[...] >>For one thing, if s is a non-empty null terminated string then, >>cdr(s) is also a string representing the rest of that string >>without the first character, > > Are you really too clueless to differentiate between C and LISP? In LISP, a list is a set of conses (pairs) whose car (first element of the pair) contains a value and whose cdr (second element of the pair) links to the next cons that's part of the list. The end of a list is marked by a cdr whose value is nil. A so-called 'C string' is a sequentially allocated sequence of memory locations which contain the characters making up the string and the end of it is marked by a memory location holding the value 0. This is logically very similar to the LISP list and it shouldn't be to difficult to understand that 'cdr(s) is also a string representing the rest of the string' means 'given that s points to a non-empty C string, s + 1 points to a possibly empty C string which is identical with s with the first character removed'. >>Null terminated strings have simplified all kids of text >>manipulation, lexical scanning, and data storage/communication >>code resulting in immeasurable savings over the years. > > Yeah, especially code that needs to deal with lengths and nulls. It's > great for buffer overruns too. This is, I think, a case where the opinions of people who have used C strings and the opinions of people who haven't differ greatly. A nice German proverb applicable to situations like that would be 'Was der Bauer nicht kennt das frisst er nicht' ... -- http://mail.python.org/mailman/listinfo/python-list