Live data from Hacker News

CL21: An experimental project redesigning Common Lisp

cl21.org

81–90 of 102 posts

Re: CL21: An experimental project redesigning Common Lisp

#81
post #73

Earlier quoted context omitted.

> People complain about the lack of run-time support for concurrency and IO in the specification. I don't think they realize, coming from other languages, that Common Lisp doesn't need it. The specification defines the language and a minimal ball of mud for doing practical work with it. Things like concurrency, threading, and IO are implementation issues and have been solved by high-quality open-source implementation…

> "car" and "cdr" are not intuitive to me. Why not use "first" and "rest" or "head" and "tail" for CL21 instead? Nothing about programming is intuitive. The problem here is that you've adopted ideas and notions from another language and are bringing that baggage to Common Lisp. If you learned Common Lisp first you might not have this very issue you describe. For historical reasons, "car" and "cdr" are the names of sp…

> Nothing about programming is intuitive.

> The problem here is that you've adopted ideas and notions from another language and are bringing that baggage to Common Lisp. If you learned Common Lisp first you might not have this very issue you describe.

Indeed, very little about programming is intuitive to a non-programmer. You're also right about me bringing in baggage from other languages. Those are valid points, yet I would still like to see CL become more appealing to programmers from other languages, whose baggage becomes relevant to their intuitions.

> Those are higher-order functions for operating on linked list and are in the Common Lisp specification anyway.

This Common Lisp reference [1] equates "cdr" with "rest". I am not familiar with the source, so is this a good reference? If so, then I must still argue that "rest" returning the cdr of a list instead of all the elements except the first is not intuitive to me. Or maybe I am misunderstanding something. My familiarity is with Clojure, not Common Lisp, so that might be interfering with my ability to understand what you mean here.

> Suggesting that Common Lisp should remove them is like saying you should remove pointers from C.

That is an interesting point. I am not very familiar with the organization of data structures in Common Lisp.

[1]: http://clqr.boundp.org/clqr-a4-consec.pdf

Re: CL21: An experimental project redesigning Common Lisp

#82
post #51

Earlier quoted context omitted.

> You know the term REPL, right? Yes, and notice how it doesn't stand for Rrepl-Evl-Princ Loop. > There is a good rationale behind those names. No, there is a good rationale for having separate functions, there is no logical rationale for prin1, princ and pprint. Let's take "prin1 produces output suitable for input to read." from the link you provided. Since we are redesigning the language anyway, let's call that eva…

Well, those functions are pretty much obsolete. No one uses them. They are only in the standard for backwards compatibility (and don't use that as an argument because that is a legitimate reason and those names are easily ignored. they are not taking up a precious name-space). Everyone binds special variables like * print-readably* , * print-circle* , * print-base* which, would you look at that, have nice comprehensi…

Is there a reference somewhere about what functions are no longer used by modern Common Lisp programmers? That would be very valuable for someone wanting to learn more about the state of the language today, instead of accidentally stumbling upon outdated practices.

Re: CL21: An experimental project redesigning Common Lisp

#83
post #71

Earlier quoted context omitted.

I can understand the reasons why people prefer to target the CLR/JVM/LLVM/BEAM/Name-your-favorite-vm but I yearn for more compiled-to-native-languages such as Golang. As attractive as partially-compiled/interpretated languages are, I simply do not enjoy creating programs in a language that can be decompiled to source so easily. We need more languages that have decent performance instead of having to drop down to poin…

By functional Fortran, do you mean like a "functional programming language" or "more productive Fortran"? As one who has developed in Fortran before, I would also like to see enhanced functional capabilities, as well as a more productive way to write code. I have spent so much time on declaring variables and function arguments over and over across subroutines that it becomes quite a pain. To avoid writing many subrou…

What happened with Fortress, fortran like enchanced language Guy Steele was developing with his team?

Re: CL21: An experimental project redesigning Common Lisp

#84
post #28
post #25

Earlier quoted context omitted.

What if you aren't interested in targeting the JVM?

Then I think the CLR would be a good starting point [1]. Or you could settle for single-threaded ClojureScript/JavaScript. [1] https://github.com/clojure/clojure-clr

You seem to be assuming that everyone writing code should be writing code for either the JVM or CLR, which is a really weird assumption.

Re: CL21: An experimental project redesigning Common Lisp

#85

Earlier quoted context omitted.

> "car" and "cdr" are not intuitive to me. Why not use "first" and "rest" or "head" and "tail" for CL21 instead? Nothing about programming is intuitive. The problem here is that you've adopted ideas and notions from another language and are bringing that baggage to Common Lisp. If you learned Common Lisp first you might not have this very issue you describe. For historical reasons, "car" and "cdr" are the names of sp…

> Where atom can be a value or a another cons cell. In this visualization it's useful to think of CAR as referring to the "atom on the left" and CDR referring to the "atom on the right." Then names like "left" and "right" rather than mnemonics for "contents of address part of register" and "contents of decrement part of register" would make sense.

There's nothing you can call them that will make any more sense than CAR and CDR. You can call them BOB and DOUG, LEFT and RIGHT, UP and DOWN, CAKE and DAFFODIL. It wouldn't matter. They're still just symbols to a function that deferences the associated pointer in a cons cell. The powers that be chose CAR and CDR and they're about as good as any.

The bonus discovery that the (car (cdr some-cons-cell)) could be shortened to CADR via a macro was just icing on the cake. Now we have a macro that can access any part of an abstract tree. Nice.

There's nothing intuitive about programming. There's no analogy you can apply to CAR and CDR or even CONS which will suddenly make sense to your primitive mind. You can't pick up a cons cell in your handle, fiddle with it, and throw it back at the computer. There's no analog in nature which resembles it. It's an ephemeral thing that only exists inside a machine because an idea someone had made it so. So stop looking.

If that's the biggest hurdle to learning Lisp I'd be surprised if someone could be taught to program in any other language. Try teaching C declaration syntax to someone.

    char *(*c[10])(int **p);
I can explain a cons cell in five minutes tell you that there are two functions for accessing its sub-parts and we can move on.

... to red-black trees, skip lists, linked lists, circular buffers, trieps, whatever.

Update: I don't mean to say I'd be surprised if someone could be taught to program in any other language in any sort of glib or pejorative sense. Of course one can learn to program without hearing about a cons cell. What I mean by that is it takes some willingness to accept abstract concepts and turn them into symbols in order to learn how to manipulate them.

Re: CL21: An experimental project redesigning Common Lisp

#86
post #83
post #71

Earlier quoted context omitted.

By functional Fortran, do you mean like a "functional programming language" or "more productive Fortran"? As one who has developed in Fortran before, I would also like to see enhanced functional capabilities, as well as a more productive way to write code. I have spent so much time on declaring variables and function arguments over and over across subroutines that it becomes quite a pain. To avoid writing many subrou…

What happened with Fortress, fortran like enchanced language Guy Steele was developing with his team?

I had not heard of Fortress before. It seems that Oracle's sponsorship of the project ended in 2012. Guy Steele emphasizes the difficulty of implementing Fortress's type system on virtual machines. [1]

[1]: https://blogs.oracle.com/projectfortress/entry/fortress_wrap...

Re: CL21: An experimental project redesigning Common Lisp

#87
post #81

Earlier quoted context omitted.

> "car" and "cdr" are not intuitive to me. Why not use "first" and "rest" or "head" and "tail" for CL21 instead? Nothing about programming is intuitive. The problem here is that you've adopted ideas and notions from another language and are bringing that baggage to Common Lisp. If you learned Common Lisp first you might not have this very issue you describe. For historical reasons, "car" and "cdr" are the names of sp…

> Nothing about programming is intuitive. > The problem here is that you've adopted ideas and notions from another language and are bringing that baggage to Common Lisp. If you learned Common Lisp first you might not have this very issue you describe. Indeed, very little about programming is intuitive to a non-programmer. You're also right about me bringing in baggage from other languages. Those are valid points, yet…

>Those are valid points, yet I would still like to see CL become more appealing to programmers from other languages, whose baggage becomes relevant to their intuitions.

I suspect that's the reason for libraries like CL21.

However the specification for the language known as Common Lisp defines a language that is mutable by the user. We don't need to change the specification to experiment with syntactic changes that could benefit new users.

> This Common Lisp reference [1] equates "cdr" with "rest".

That would be a common mistake I've had to overcome when I first started learning Common Lisp. Consider:

    (cdr '(1 . 2))
What's the value?

Hint: It's not a list. So why conflate CDR with REST? They're completely different things.

    (cddr '(1 . (2 . 3)))
What's the value? Can you guess how that works? Hint... if it's a macro it might expand to:

    (cdr (cdr '(1 . (2 . 3))))
http://www.lispworks.com/documentation/HyperSpec/Body/f_car_...

Again, not REST. Not a list. It just so happens that when you have a structure like:

    (1 2 3 4)
You can get (2 3 4) by:

    (cdr '(1 2 3 4))
But that's because:

    (1 2 3 4)
Is the same as:

    (1 . (2 . (3 . (4 . nil))))
And that is the only syntactical sugar Lisp has afaik. You could configure your printer to print out the actual cons structure if you'd like but the shorthand is useful because this data structure in particular is so eponymous.

Re: CL21: An experimental project redesigning Common Lisp

#88

Earlier quoted context omitted.

> Where atom can be a value or a another cons cell. In this visualization it's useful to think of CAR as referring to the "atom on the left" and CDR referring to the "atom on the right." Then names like "left" and "right" rather than mnemonics for "contents of address part of register" and "contents of decrement part of register" would make sense.

There's nothing you can call them that will make any more sense than CAR and CDR. You can call them BOB and DOUG, LEFT and RIGHT, UP and DOWN, CAKE and DAFFODIL. It wouldn't matter. They're still just symbols to a function that deferences the associated pointer in a cons cell. The powers that be chose CAR and CDR and they're about as good as any. The bonus discovery that the (car (cdr some-cons-cell)) could be shorte…

> There's nothing intuitive about programming.

If that was true, than naming constructs in programming languages wouldn't matter at all.

> If that's the biggest hurdle to learning Lisp

Its not, its just one of many small hurdles that keep Lisp as a fairly niche language, despite its strengths when viewed from a 30,000 foot level.

> Try teaching C declaration syntax to someone.

C-family languages declaration syntax is a major factor in the popularity of dynamically typed languages (newer statically typed languages that are starting to take back some ground mostly reduce both the clutter of that syntax and the need for declarations at all.)

So, other than illustrating the a similar (but larger) problem to the car/cdr problem, I'm not sure what the relevance is.

Re: CL21: An experimental project redesigning Common Lisp

#89
post #57
post #55

Earlier quoted context omitted.

One word: lenses.

And how would that look for this particular example?

Definitely not as terse but far more general, flexible and powerful. With car and cdr you're restricted to working on cons cells while lenses are generic.

Some examples (from Haskell):

    >>> ((((5,4,3,2,1),6),7),8,9) & view (_1 . _1 . _2)
    6
    >>> ((((5,4,3,2,1),6),7),8,9) & (_1 . _1 . _2) .~ 4
    ((((5,4,3,2,1),4),7),8,9)
    >>> let foo = ((((5,4,3,2,1),6),7),8,9)
    >>> foo & view (_1 . _1 . _2)
    6
    >>> let six = _1 . _1 . _2
    >>> foo & view six
    6
    >>> foo & six .~ 4
    ((((5,4,3,2,1),4),7),8,9)
    >>> foo & six .~ "abc"
    ((((5,4,3,2,1),"abc"),7),8,9)

Re: CL21: An experimental project redesigning Common Lisp

#90

Earlier quoted context omitted.

There's nothing you can call them that will make any more sense than CAR and CDR. You can call them BOB and DOUG, LEFT and RIGHT, UP and DOWN, CAKE and DAFFODIL. It wouldn't matter. They're still just symbols to a function that deferences the associated pointer in a cons cell. The powers that be chose CAR and CDR and they're about as good as any. The bonus discovery that the (car (cdr some-cons-cell)) could be shorte…

> There's nothing intuitive about programming. If that was true, than naming constructs in programming languages wouldn't matter at all. > If that's the biggest hurdle to learning Lisp Its not, its just one of many small hurdles that keep Lisp as a fairly niche language, despite its strengths when viewed from a 30,000 foot level. > Try teaching C declaration syntax to someone. C-family languages declaration syntax is…

> If that was true, than naming constructs in programming languages wouldn't matter at all.

http://dictionary.reference.com/browse/intuitive

I think we're diverging off the track here. Naming is important. Programming has borrowed quite a lot from various places to name the often weird, alien "things" we work with. But a rose by any other name is still a rose.

There is no name for which there exists an analog in nature that we can apply to CAR and CDR. You can't think about them intuitively. As demonstrated elsewhere calling them FIRST and REST is a mistake. FIRST, SECOND, THIRD and so one are just English words for for CAR, CADR, CADAR, and so on.

So it's best not to get stuck in the "intuitive" trap. CAR and CDR have stuck around because people have argued about it endlessly for 40 years and haven't come up with a better name. They took on abstract symbols and the people writing Common Lisp code kept shipping systems.

> Its not, its just one of many small hurdles that keep Lisp as a fairly niche language

I don't think that's the reason for it's lack of market share. That has more to do with corporate politics and business. Read up on the history of Symbolics.

tldr; there were once only commercial implementations of Common Lisp that cost far too much and delivered little. Because money.

So a couple generations of programmers didn't get exposed to it as their first language.

> C-family languages declaration syntax is a major factor in the popularity of dynamically typed languages

Is that so? Why then are their interpreters and virtual machines written in C or some other language? PyPy is making an effort but even then... lots of C. Most implementations I've seen of Common Lisp are written in Common Lisp. Odd.

CAR/CDR isn't a problem. I've explained it five times in various posts on this thread. There's even a link to the HyperSpec (the HTML form of the ANSI specification). It's quite simple.

The real problem is that Common Lisp isn't the first language for most "newcomers." So they come packed with notions and biases that they forget to leave at the door. If C is your first language pointers aren't a big deal and you learn to read the declaration syntax. You know it's not great and that it's difficult to pick up but once you get it you move on. In a similar fashion when you pick up Lisp you figure out CAR and CDR.

Changing the names of CAR and CDR isn't going to make Lisp any more appealing to newcomers. You just have to learn what they are and move on.

Post reply on HN