Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Lisp is called "hackers language"?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I'm reading "Programming Clojure" these days.
Lisp looks really complicated and hard to digest language.
Why many says Lisp is the language for the true hackers? just because it is hard to learn and master? or because it is hard to read Lisp code and it will make you looks smarter if your program with it?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basics of Lisp are not hard to pick up at all, but it is quite different from the FORTRAN family of languages that you're used to (i.e., C, Java, etc). You can get very far just knowing that a function call in Java like

foo(1, 2, 3)

looks like this in Lisp:

(foo 1 2 3)

and in general, operators like "+" are defined as functions, so

int twenty = 2 + (3 * 6);

might look like (depending on the Lisp dialect)

(let 'twenty (+ 2 (* 3 6)))

What makes it a "true hacker's language" (and here the word "hacker" has to mean "computer guru", not "two-bit criminal") is that it's just absolutely wide open and flexible. You can define your own syntax, and often do. You can create any sort of programming paradigm you like and include it in your programs. If you can imagine it, you can do it. It enforces virtually no structure. This tends to make large Lisp projects very hard to understand if you weren't involved in their creation.





 
Campbell Ritchie
Sheriff
Pie
Posts: 50245
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you think small LISP applications are easy to understand?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because they are, when written well.

As far as large Lisp systems being difficult to understand, that completely depends on implementation choices. Lisp programs tend to coalesce into a problem-specific DSL: Lisp programs look like the problem they're trying to solve. Java programs look like Java programs (this is not as true as it used to be, but there's still a big difference).

But I don't find a DSL any more difficult to understand than its equivalent program: I still have to look up methods, I still have to understand method inputs and outputs, I still have to understand the problem domain.

The one area where Lisps can get very convoluted *very* quickly is macros. From a *reading* standpoint, macros can simplify things immensely. From a writing, maintainability, and debugging standpoint, they can be a nightmare of epic proportions. I still occasionally wake up crying in my closet remembering a 30-line macro written by a PhD student that neither he, nor I, could figure out for over a week, and he was the one that wrote it, less than six months earlier.

Macro debugging is a non-trivial exercise.

Clojure has some great advantages over previous Lisps. I find it slightly easier to read due to some syntactic additions (it's not as "pure" as earlier Lisps, but this was a conscious decision on Rich's part). Its functional nature is terrific.

One thing I *don't* like about Clojure is the removal of user-defined reader macros--but I *completely* understand why the decision was made, and I respect it, even though I disagree with it. Clojure is my language of choice on the JVM, although I'm still getting back into Lisp mode after several years off. It's elegant, extremely fast, supports extremely tight JVM integration, can produce interfaces usable directly from Java (this has interesting implications), and is great for producing internal DSLs.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Todd wrote: just because it is hard to learn and master? or because it is hard to read Lisp code and it will make you looks smarter if your program with it?

Neither, but the second one is way less of a reason than the first.

Lisp changes the way you think about programming. *Any* language does (hopefully), but Lisp is more insidious than most. Clojure even more so because it's quite a bit more functional than many (most, really) languages. Because you can implement essentially any solution you want, you can design a system that approaches the problem in the way that makes the most sense.

Modulo some syntax difference, you can implement Prolog in a few hundred lines of Lisp. Clojure/Scheme/Lisp aren't OO--no problem, implement the OO paradigm that makes the most sense for your problem space (classical, prototypal, you name it). CLOS is just macros and functions on top of CL.

With that power comes great responsibility--or you *will* end up with a large, unreadable system--but it's not a given that you will.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all guys and thank you David for the lengthy explanation and it is really nice to know that Clojure is your favorite JVM language .
Please correct me if I'm wrong but with Lisp I can create any language I want? I can create an OO language or even a FP language?
After finishing the book, what can I do?
How/where I can employ Clojure?
I don't mean using Clojure just because I can of course, I'm just curious if it can brings value to my projects.
For example, suppose I'm doing Java web application, where to use Clojure?
One more thing:
I don't want to change the subject of this thread but I'm curious to know your opinion David regarding Scala and JRuby (I can start a new thread if it is necessary).
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please correct me if I'm wrong but with Lisp I can create any language I want? I can create an OO language or even a FP language?

Clojure already *is* functonal. You can create any language within the constraints of Clojure syntax (internal DSL), otherwise you have to build lexer/parser/etc.
After finishing the book, what can I do?
How/where I can employ Clojure?
I don't mean using Clojure just because I can of course, I'm just curious if it can brings value to my projects.
For example, suppose I'm doing Java web application, where to use Clojure?

That's not really a meaningful question--you can use it however you want. Clojure has at least a couple of web frameworks as well. At yesterday's NYC Clojure User Group talk a financial guy talked about using it to create data file parsers, Java interfaces, etc. using a fairly simple DSL. Right now I'm using Groovy to define sets of rules and dependencies, but may switch it to Clojure (no technical reason to do so at this point, but that might change).

I'd suggest reading On Lisp by Paul Graham, or perhaps the new-ish Lisp over Lambda (I think that's its name) if you're interested in macros at all.
Scala and JRuby.

I don't know enough Scala to be super-helpful, but I think its type system is promising. I like Ruby a lot, so I like JRuby a lot, and it's a good Ruby implementation. I move back and forth between it for Java prototyping.

I'd council against learning Lisp if you just want to appear smart--nobody will be impressed.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David,
No I'm not looking to appear smart, I'm just curios to know if Clojure could brings value to my projects.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, if you need what it offers. Using it for the sake of using it, if it's for work, not cool. For personal stuff, sure. For educational purposes, sure--I recommend people learn Lisp, Smalltalk, Forth, and C at the very least, because they *will* make people better programmers, even if they're never used professionally.
 
Mike Pukuotukas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True hackers enjoy writing Lisp interpreter in Java, a really amazing task. Try, after that you will learn List and will like it. Same as FORTRAN (List is just one year older) the interpreter is relatively straightforward to implement and can teach many interesting things. Who wants to use our applet to learn Lisp, it is here with all source code under GPL.
 
Bruce Tate
Author
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not a hacker, but when I worked through Clojure for Seven Languages in Seven Weeks, I thought Clojure's concurrency strategies and sequences were wicked cool. It's in my top 3 or 4 favorite languages. It's like Lisp ++.
 
Lanny Gilbert
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know why it's called a "hackers language", but it is very elegant and definitely a new way of looking at things.
I think it's like one of those old HP calculators that had reverse Polish notation for doing calculations (instead of entering 2+4, you would press 2 ENTER 4 +).
Same thing with Lisp, once you grasp the beauty, it's hard to go back
 
Bruce Tate
Author
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lanny Gilbert wrote:Don't know why it's called a "hackers language", but it is very elegant and definitely a new way of looking at things.
I think it's like one of those old HP calculators that had reverse Polish notation for doing calculations (instead of entering 2+4, you would press 2 ENTER 4 +).
Same thing with Lisp, once you grasp the beauty, it's hard to go back


Yeah. Lisp definitely has a symmetry about it. It's beautiful in a lot of ways. But... but.

Timothy Bray once posted on his blog that such a language really taxes your short term memory. I think that's true, because the language is generally not structured like our language, or our math.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic