News for hackers. Stuff that matters.
Re:Getting Started with Lisp (2019) by kazinator on Monday December 21, 2020 @12:39PM (#25497215)
Until you write a procedure that walks a structure using cons/car recursion, ha. :)
Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @03:21PM (#25499118)
That happens in so many languages bar the name and even in some Lisps they aren't called that.

Even in Common Lisp, the names typically used are “first” and “rest”, not “car” and “cdr”

Re:Getting Started with Lisp (2019) by phoe-krk on Monday December 21, 2020 @04:54PM (#25500088)
I must disagree. I see a lot of CAR and CDR calls in code that I see daily.

Also, it's a style error to use FIRST and REST when one operates on cons cells, because those imply a different meaning - that one operates on lists. Sure, the language doesn't care whether you use CAR or FIRST, but the programmer does - and they might know that you treat a cons cell as a pair unto its own, rather than an element of a linked list.

Re:Getting Started with Lisp (2019) by kazinator on Monday December 21, 2020 @05:13PM (#25500254)
Feel free to substitute the Python version of getting the first and rest of a list (well, the array that Python calls a list). My comment is not about names, but semantics.
Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @05:31PM (#25500446)
`list[0]` and `list[1:]`?

Almost any language has convenient ways to get the first element of a sequence, and all but the first, even C, this is not unusual at all to lisps.

Re:Getting Started with Lisp (2019) by kazinator on Monday December 21, 2020 @06:36PM (#25501081)
But car and cdr in Lisp and Scheme only retrieve values; they do not copy any aggregate object.

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

Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @08:24PM (#25501835)
> 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.

Re:Getting Started with Lisp (2019) by lhjn on Tuesday December 22, 2020 @07:55PM (#25513258)
Lists are mutable in CL
Re:Getting Started with Lisp (2019) by Blikkentrekker on Wednesday December 23, 2020 @07:43PM (#25524028)
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.