Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> But car and cdr in Lisp and Scheme only retrieve values; they do not copy any aggregate object.

That's because lists are mutable in Python.

Do it on tuples and they retrieve and do not copy.

Of course in C, one can simply do `ptr[0]` or `ptr+1` which also only retrieves.

> When was the last time you saw recursion on list[0] and list[1:] in a production Python program, or even a tutorial?

That is purely a difference of culture, not of what the language facilities, both Scheme and Python allow either style.



Lists are mutable in CL


That would be another thing then where the two Lisps are very far apart, and Python is closer to one of them.

Lists are not mutable in Clojure, they are “technically mutable” in R6RS Scheme, but it requires opening up a specific module that many Scheme implementations do not even provide unless compiled with specific flags.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: