News for hackers. Stuff that matters.
Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @12:15PM (#25496969)
“Lisp dialects” is as if one talk about “dialects of curly braces languages”.

I would argue that Python is closer to Scheme than Common Lisp is.

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.

Re:Getting Started with Lisp (2019) by ska on Monday December 21, 2020 @01:54PM (#25498076)
python really isn't that close to scheme in any practical and theoretical way, even if it has half heartedly embraced lambdas, and has a usable REPL.
Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @03:24PM (#25499147)
Indeed it isn't, and it's still closer than Common Lisp is to Scheme.

Common Lisp's evaluation semantics are a language of it's own practically at this point and are very far removed form most languages.

Scheme is of course very unusual, due to it's including the very unusual `call/cc` primitive operator.

Re:Getting Started with Lisp (2019) by phoe-krk on Monday December 21, 2020 @04:52PM (#25500062)
> Common Lisp's evaluation semantics are a language of it's own practically at this point and are very far removed form most languages.

Huh? What do you mean? The separate function namespace? Evaluation rules in CL, strictly speaking, are very simple.

* Symbols evaluate to variable values, lists evaluate to function/macro/special operator calls, and everything else evaluates to itself.

* The first element of a list is either a symbol that names a function/macro/special operator, or a lambda form that denotes an anonymous function.

* If we're calling a function, evaluate all argument forms and apply the function to them; if we're calling a macro, pass all argument forms as-is into the macroexpansion function; if we're calling a special operator, it's up to the implementation to make sense of this.

What's this "a language of its own" that you mean?

Re:Getting Started with Lisp (2019) by ska on Monday December 21, 2020 @03:26PM (#25499165)
> Indeed it isn't, and it's still closer than Common Lisp is to Scheme.

On this we disagree.

Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @03:34PM (#25499242)
Explain why? What is it that Common Lisp and Scheme have in common aside from the syntax that Python doesn't?
Re:Getting Started with Lisp (2019) by ska on Monday December 21, 2020 @05:19PM (#25500310)
Ok; One thing that makes this not obvious is that common lisp is a huge language, and scheme is a small one. And since common lisp is multiparadigm, you can work with it in ways that are very much not not like scheme. But you can also use a subset with a very similar paradigm.

Some of it is philosophical I suppose. Fundamentally they are both lisps. Both opinionated about what that means, but they are lisps.

The fundamental objects in the language are congruent. I find them quite similar for REPL driven exploratory design, in a way that python never quite gets. Although there is a deep schism on macro hygiene, they both have deeply integrated macros. They both allow for clean functional approaches and deep recursion in practice. Both get low level enough to get decent performance from the language itself (unlike python).

I guess what I'm saying is I can write CL code that feels very scheme like in approach and also is comfortable in the language. The same is not close to true of python.

Re:Getting Started with Lisp (2019) by Blikkentrekker on Monday December 21, 2020 @05:37PM (#25500518)
> They both allow for clean functional approaches and deep recursion in practice.

Please tell me what kind of functional approaches Common Lisp and Scheme allow that Python doesn't.

Scheme is the only one o the three that has t.c.e. as a language feature, of course.

> Both get low level enough to get decent performance from the language itself (unlike python).

Scheme is far, far more performant than C.L. and that's due to language design choices.

> I guess what I'm saying is I can write CL code that feels very scheme like in approach and also is comfortable in the language. The same is not close to true of python.

I think you might simply not know how to or believe that it feels more Scheme like simply because it's written in a similar syntax.

Even JavaScript started as a Scheme dialect that later was given alternative syntax, mind you.

There is however one big thing: and that is that Python lacks true block scope, which both Scheme and Common Lisp have, but on the flip-side Common Lisp has dynamic variables, and different cells for functions and values. as well as `setf`.

Re:Getting Started with Lisp (2019) by lispm on Monday December 21, 2020 @06:20PM (#25500935)
> Scheme is the only one o the three that has t.c.e. as a language feature, of course.

Though Common Lisp implementations have been providing it for decades. 't.c.e.' is an optimization feature of various Common Lisp compilers.

> Scheme is far, far more performant than C.L. and that's due to language design choices.

That's not the case.

Actually Common Lisp has a lot of language features which make it performant: stack allocation hints, type hints, inline declarations, compilation semantics, implementation specific feature limits, etc. One of the design goals of Common Lisp was to support optimizing compilers on various platforms.

Re:Getting Started with Lisp (2019) by Jtsummers on Monday December 21, 2020 @06:08PM (#25500811)
I've mostly been staying out of this thread because I really don't know what the point of this discussion is, but:

> Scheme is far, far more performant than C.L. and that's due to language design choices.

That's nonsensical. You're comparing language specs for performance, and not implementations here. Both can achieve high levels of efficiency from their code, depending on the implementation decisions taken by the particular compiler/interpreter you're electing to use, as well as which data structures and mechanisms you elect to use from each language.

Re:Getting Started with Lisp (2019) by ska on Monday December 21, 2020 @06:40PM (#25501117)
> Scheme is far, far more performant than C.L. and that's due to language design choices.

Even if that claim is empirically pretty dubious it's idiosyncratic at best to compare putative design impacts of specifications (rather than implementations) between CL and scheme ... when python is in your mix.

I suspect this isn't going anywhere useful so I'm out.