4 ms·
> 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 Co
by bmh100 12y ago
> 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 http://clqr.boundp.org/clqr-a4-consec.pdf
- agentultra 12y ago>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_c.htm 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.