2,130 karma · joined June 6, 2008
[1] http://www.dancarlin.com/disp.php/hharchive [2] http://www.dancarlin.com/disp.php/csarchive
As I pointed out in a comment at the beginning of the thread, scheme teaches you some habits that don't translate well to other lisps, so to those thinking of picking it up, be mindful of the assumptions of the language, and when you decide to look into other lisps, don't assume they will be the same there as well.
In fact i would actually recommend learning clojure or common lisp before scheme. I consider both of them to be better languages, but i have my own set of assumptions that might not be shared by others :).
Yes. If you read enough Clojure, Scheme and Common Lisp code you'll see that they have their own different styles. On a few occasions I read Common Lisp code written by schemers, it was somewhat ugly and inelegant, although the same code would have been elegant if written in scheme. Here's an example from an Erik Naggum article( http://www.xach.com/naggum/articles/3195982690560792@naggum.... ). First the Scheme in common lisp:
(defun make-account (balance)
(labels ((withdraw (amount)
(if (>= balance amount)
(progn
(setf balance (- balance amount))
balance)
(format t "Insufficient funds")))
(deposit (amount)
(setf balance (+ balance amount))
balance)
(dispatch (m)
(cond
((equal m 'withdraw) withdraw)
((equal m 'deposit) deposit)
(t (format t "Unknown request -- MAKE-ACCOUNT")))))
dispatch))
Perfectly reasonable way to do it in Scheme, not in Common Lisp. Heres how you do it in idiomatic Common Lisp: (defclass account ()
((balance :initarg :deposit :initform 0 :accessor balance)))
(defmethod withdraw ((account account) amount)
(decf (balance account) amount))
(defmethod deposit ((account account) amount)
(incf (balance account) amount))
(defmethod withdraw :before ((account account) amount)
(unless (<= amount (balance account))
(error "~A has insufficient funds to withdraw ~A." account amount)))
I'll let the code speak for itself :)Lisp allows you to turn code like the first example into code like the second.
edit: formatting
I can still show you examples of beautiful and horrible 20 line lisp programs, but I'd rather show you examples of large scale design. The most popular might be Emacs. Emacs has a million lines of elisp, imagine if it was written in java or C++, scary thought :)
In a large system like emacs you'll find many examples of beautiful and ugly code, but the overall system is still beautiful and maintainable. This talk by Stuart Halloway might explain what i mean by that: http://vimeo.com/1013263
In a nutshell, emacs is big, but small for its size, meaning that those 1000000 lines of lisp do much more than a million lines of java will ever be able to do. That property comes in part by using a lisp as an implementation language(and not a very good lisp at that :)
Choosing between the two could be hard, but my general advice is that if one prefers a more strict FP approach, Clojure is better, and if one prefers to have more choice over what paradigm to use when, a good multi-paradigm language like Common Lisp can make you happy. I happen to like the latter. Which reminds me, I have a lot of lisp hacking to do, enough HN for the evening.
But seriously, i think its great that we can all work in our favorite language, and we can get away with it. I can write a web service in common lisp, and you can use it in your Rails cat picture app, that also uses a brainf*ck script to convert the cat pictures in a suitable format. And your company can also write an iPhone version of your app in objC and a desktop version in C++ for windows and Linux. Man, protocols are awesome :)
Recently I sat down and thought about where I want to be in 5-10 years. I don't want to be writing django apps in 10 years, I don't want to write software that sort of works some of the time, and i don't want to be a replaceable commodity programmer working on outsourced software that the real programmers didn't feel like working on, so they send it to India, or Eastern Europe(which is where I’m from). Sure, I can make a comfortable living that way, but what I want to be in 10 years is a competent expert.
I want to work in diverse fields, with people much smarter than me, and the little knowledge and experience I can gain in my career I want to pass down to younger programmers. I want to wake up in the morning and be proud that I've build things that actually matter, and not just the latest social networking pop-culture crap that many of us are dealing with now. In short, i want to e a hacker!
To do this, I decided to dedicate myself to actually learn the hard stuff that most people shy away from, just because they can get by with only some python/ruby/php and jquery knowledge. Math, CS(algorithms, data structures, languages, compilers, architectures, networks, operating systems), science, philosophy, history, art, etc. All hard stuff that I'll never need to know in order to build a web store site for a small business that barely gets the web, get paid, and go wash the car on the weekend. Even if i can never learn all of it, even a fraction is better that writing the same simple web apps for 10 years.
I was already playing around with Scheme and Clojure for at leas two years when I started learning Common Lisp, very few things have been exceptionally hard or foreign for me, loop was definitely not one of them.
That's the reason I get so hot-headed about these kinds of things. I have invested a lot in bettering my self as a programmer. Articles like this one insult years of hard work, and my own effort is just a very small part of it. People have been building these tools and communities for 50 years before I even knew what a computer was, dismissing it so lightheartedly pisses me off. I only hope others understand. Maybe I just have too high standards. Comes with being young I guess :)
p.s. And an expert is exactly what I want to become, I have no ambition to be a code monkey. I'm truly sorry if expertise and skill are valued less these days in the tech circles. "Good enough" is not good enough for me. I look up to the experts and brilliant minds of our community and aspire to be as good one day, I don't care much for the general case, i have no use for "a language for everybody".
If the Clojure community thinks that its better to attract more Ruby and Java programmers, and alienate other lispers, please, keep producing ignorant crap like this.
Claiming Common Lisp is dead and comparing it to C++? Why should anybody listen to somebody’s extremely narrow minded opinion on THE FUTURE OF LISP, when that person has shown that he knows NOTHING about lisps past and present.
Mr. Fogus, you know much better that to post such ignorance to Hacker News. Keep Clojure awesome, don't let the fanboys spread FUD. Inter-dialect respect, yaw! :)
I don't use clojure much these days, but in Common Lisp I use generic functions(the original inspiration for protocols and multimethods) all the time, and find them the second most important feature of CL after macros.
I haven't been paying attention to the world of python books for a while, but i started with the O'Reilly books by Mark Lutz.
Read this: http://www.paulgraham.com/progbot.html
p.s. try http://www.hnsearch.com/
* I love lisp. I admit that as long as i can't find a reason NOT to use it, i will.
* Me and my partner still don't know exactly what we want to do. We have a few ideas, but both of us are pretty inexperienced, both technically and business wise. Common lisp is excellent for experimentation and many people have had success using it to fill in the gaps in their knowledge about a certain domain. My next couple of weeks will consist of just building "stuff".
* I don't understand what other advantage does a full stack framework have, except that it made a bunch of choices for you(ORM,template engine, structure of your program). If I were to write an app in python, i might be tempted to use something like flask(or some other "micro-framework"). I like the idea of hooking together different libraries, rather than filling in the blanks of a full stack framework.
Basically I've found no reason not to use lisp, if you know it. Don't let the reddit story scare you, things have changed TREMENDOUSLY in the past several years.
Now there are a lot of common lisp success stories, i made the time to search for them(I'm not about to invest my entire summer in something without learning from others first :D). Check out mahmud's comments here on HN, for some of his experience, to cite just one example. Search, don't just ask. This this thread is mostly identical to at least 3 others I read in the past week while reading old threads about lisp and web development.
Another excellent lisp is clojure, and people have been using it for web apps to great success as well. I chose common lisp over it, because I prefer multi-paradigm languages over ones with stronger accents(whether its OOP or FP). But clojure is still my second favorite language, and if you're into FP, check it out.