This is a continuation of a discussion from another thread.
I have reduced the amount of quotes to make this a bit more readable and concentrate on the important points.
usagi wrote:
Harleqin wrote:
Quote:
They don't have a compiler. Well, that isn't actually true, but no one has the libraries.
No, to both; these are common myths without any connection to reality. Almost all modern Common Lisp implementations have compilers and use them. Also, there are tons of libraries for any purpose you might imagine. The most popular can be installed through clbuild, the gentoo lisp overlay, asdf-install, or (brand new) quicklisp. You can also browse Cliki.
Well, clbuild is not a compiler, it's a development tool that tries to find a compiler (such as SBCL, which is UNIX-only) to help Lisp progammers. I did find out however that there is CLISP for windows, which does include a compiler.
You made two claims: that there were no compilers, and that there were no libraries. I replied that there are compilers everywhere, and that there are lots of libraries, which can be installed through the means I listed. SBCL is not UNIX-only, by the way.
Quote:
I wasn't implying Lisp has a lack of windowing capabilities. I was referring to having to rewrite a linked list library for Lisp for each program since it doesn't have any high level list processing capabilities. Such as a generic list copy function.
That is simply not true. Your problem is that you do not understand lists. What does it mean to copy a list? I return to that further below.
Quote:
Then why isn't Lisp used more often in a corporate/business environment?
Because people like you are running around and proclaiming things about Common Lisp like it was still LISP 1.5. The corporate/business environment is always doing things like everyone else, so this negative propaganda is quite effective.
Quote:
One asks, what's the use of abstract syntax trees, anyways?
Quote:
They represent the logic/syntax of the code, which is naturally a tree rather than a list of lines, without getting bogged down in concrete syntax issues such as where you place your asterisk.
The logic can then be manipulated in a manner more consistent and convenient from the backend's POV, which can be (and is, for everything but Lisps

very different from how we write the concrete syntax.
(from:
http://stackoverflow.com/questions/3860 ... ntax-trees)
And there you have it.
What do I have?
Quote:
Further.. I should probably comment on your tactic of claiming I don't understand Lisp. That is indeed true to a degree but it doesn't mean I don't know what I am talking about. Claiming that I don't know Lisp is a cheap shot, one which backfired here because I was able to show a strong knowledge not only of Lisp's history and reasoning during implementation but to provide actual code examples which clearly demonstrate what I was talking about.
No, you presented half knowledge and jumps to conclusions without basis. In each of your examples, I first have to correct misconceptions and then try to answer what questions remain.
Quote:
While at the same time you made claims about Java that aren't true (like, for instance, you can't pass functions).
Ah, so how do you pass a function to something like MAP in Java? In other words, how do you translate this code snippet:
Code:
(mapcar #'foo my-list)
i.e., given a list, return a new list composed of the return values of applying the given function to the given list. A more concrete example:
Code:
(mapcar #'+ (list 1 2 3) (list 3 4 5))
i.e., given the two lists (1 2 3) and (3 4 5), return the result of adding them element-wise (this should return
(4 6 8)).
Quote:
Here is one very simple yet poigant example which I came up with in about 2 minutes playing around in JLisp51 (
http://www.kenliu.name/software/lisp51/lisp51.html)
A.
(list 1 '(2 3) 4)
;Output ==> 1 (2 3) 4
B.
(list 1 (list 2 3) 4)
;Output ==> 1 (2 3) 4
From the examples above one would think (list 1 2 3) and '(1 2 3) would produce the same result.
And indeed, they do.No, they do not. You have not understood what
quote does.
(List 1 2 3) returns a new list containing 1, 2, and 3, while
'(1 2 3), which is the same as
(quote (1 2 3)), returns a
list literal.
Quote:
The shocker comes when you try to actually use that in a real program, you know, to do something elegant:
C.
'(1 (list 2 3) 4)
;Output ==> (1 (LIST 2 3) 4)
D.
'(1 list(2 3) 4)
'Output ==> (1 LIST (2 3) 4)
E.
'(1 '(2 3) 4)
'Output ==> (1 (QUOTE (2 3)) 4)
Do you see what the problem is? You can '(2 3) or you can (list 2 3). You can '(1 2 3) or you can (list 1 2 3). But there is a difference between "'(1 (list 2 3) 4)" and "(list 1 (list 2 3) 4)". Therefore, the syntax is irregular.
How on earth did you come to expect
list and
quote to be the same thing? The only thing irregular here is your expectation.
Quote:
Harleqin wrote:
Quote:
I mean, look at the above Lisp. No wonder they invented syntactic sugar. But when do you stop? Why don't you just write
Code:
CustomerList.add(CustomerRecord);
and be DONE with it all? Finally and forever?
I do! I write
Code:
(push customer-record customer-list)
and that's it.
Why didn't you just write that in the beginning? Why all the examples with list?
Because you did not ask the question. You just presented some misconceptions, which I corrected.
Quote:
You're right that I don't understand Lisp very well, although I gurantee I know more about it than any other Java programmer you're likely to encounter.
No, you seem quite average in that respect.
Quote:
Of course they don't use cons. Cons are CAR, CBR, etc. which come from IBM 704 hardware address register names -- i.e. Contents of Address Register (CAR).
That is just the name (it is CDR, by the way, not CBR). Common Lisp also defines FIRST and REST as aliases for them. However, cons cells are more flexible than just to build lists.
Quote:
Every first year comp.sci student is taught how to implement linked lists. We don't need cons to understand that. You probably meant to say "you have not understood how Lisp implements lists". But indeed I do.
And therefore, that cons aren't actually lists at all is precisely the point I was making.
Well, that is another misconception of yours: a cons cell is not a list, obviously. It is (or better: can be used as) a
list node.
Quote:
That is what leads to the problems I mentioned about not having higher level list manipulation functions, and having to reinvent the wheel each time you write a program.
Now we return to your list manipulation problems. Just take a little look at the HyperSpec:
the conses dictionary. There, you have everything you need, including, for example, using lists as sets. That is just what is in the language standard itself; there are several libraries providing more functions. Examples include SERIES, which implements lazy lists and generators, and ALEXANDRIA, which has several utilities, as well as a shallow copy-list.
Looking at why there is no copy-list in the ANSI Common Lisp standard, you have to ask, what does it mean to copy a list? Should the objects contained/referenced in the list also be copied? How deep does this go? There is COPY-TREE in the standard, which recurses into every cons contained in the list/tree (conses are more flexible than simple list nodes, because you can put more lists in both parts of a cell, thus constructing a tree). The ALEXANDRIA copy-list is a simple
(mapcar #'identity list), if I recall correctly.
Quote:
Harleqin wrote:
Quote:
But I remain puzzled by people's attachment to a 50 year old language with hard to grasp, irregular syntax, that has no higher level list operators.
It is not irregular, it is easy to grasp (unless you cannot let go of ALGOL-derived syntax), and it has all kinds of higher level list operators, many of which you do not even find in Java and similar languages. Where is MAP, MAPCAR, MAPCON, MAPL, MAP-INTO, REDUCE in Java? What, you cannot pass functions? What kind of stupid language is that? You should consider that the people who are attached to Lisp even though they know the ins and outs of Java and similar languages perhaps have found something.
You can't seriously believe that there is something in Lisp that can't be done in a serious, modern programming language.
Not "can't be done", obviously (because of Turing equivalence and all that). However, I do not see how you would emulate the three-tier condition system (condition, handler, restart) in Java, which only has a two-tier exception system (exception, catch). I also know that, for example, the lack of multiple dispatch can be worked around in the elaborate visitor pattern, but that adds a lot of ever-replicated effort, which cannot even be refactored due to the lack of a real macro system. I do not know how to get something like advices (before, after, and around-methods) in Java.
Quote:
Hell I could even write a MAPC function if I really wanted to, something which would allow me to do mapc(function, arguments), just like in Lisp. The question is why I would want to. If there was a pressing need to do that I could do it.
And you were complaining about the lack of higher-level list functions?
Quote:
Now consider lisp. There is a pressing need for a generic list copy function. What do I do? Help me solve this problem! I ask because I really want an answer -- it's probably the one thing keeping me away from trying something in Lisp.
See above.
Quote:
Harleqin wrote:
Quote:
The examples you give can all be written in one line of Java (or whatever); something like CustomerList.add(CustomerRecord); where CustomerList and CustomerRecord are variables/lists/whatever.
Again, you simply have no idea of even the basic functions Lisp provides.
(Push customer-record customer-list). That is even without going into the power CLOS (the Common Lisp Object System) provides. I am pretty sure I can match any Java code snippet you provide with a more concise and at least as readable version in Common Lisp.
Of course you could. I can do the same in Java; you just write a macro or function or class or whatever to do whatever you want and then call that. "push" is, in fact, a Lisp macro. Real lisp takes several lines to do that as you demonstrated in an earlier post. But in Java (for example) .add a feature of the language itself; it is not a macro. The difference is that push cannot redefine the core structures used by Lisp. .add, in Java (for example) IS the core structure of the langauge, and it works on anything. Unlike push.
Macros
are real Lisp. We can go into implementation philosophy, too, but that is a different can of worms. I shall just mention here that I do not have to wait for the language designers to implement a new keyword.
Quote:
Harleqin wrote:
Quote:
What you mentioned about coding your problem domain and thinking in terms of that has, generally speaking, already been done. So from the standpoint of someone who has a great deal of experience with languages, including Lisp, I wouldn't recommend for beginners.
You obviously do not have any great experience in Lisp.
No, for the reasons I mentioned, I do not have any great experience in Lisp. But that isn't really an answer to what I said -- it's just trying to discredit what I said by claiming I don't know what I am takling about.
Yes, of course. The problem is that you claim great experience and that therefore, you are right about Lisp being inferior to any modern language (even Java). You are giving yourself too much credit, and that has to be addressed, too, in addition to refuting your other, more concrete claims.
Quote:
A lot of what you said does indeed make sense, but please keep in mind you can code any language to do whatever you want. There is hardly a language alive today where you CAN'T code your way out of whatever wet paper bag you find yourself in.
Yes, this is known as the Turing tarpit.
Quote:
Whether or not I am an experienced Lisper has no bearing on that. You do not have to be an experienced Lisp programmer to understand the history, implementation and use of a language.
Perhaps not, but you do not seem to have understood it anyway.
Just to be clear: I do not claim that Lisp is superior to any other modern language. I only claim that it is at least equal to others.