Live data from Hacker News

On Lisp

paulgraham.com

71–80 of 107 posts

Re: On Lisp

#71

Any advice or link for someone new to Lisp like me? Also, is there any good open source project using Lisp that I can fork/download and tinker with? I'm still having problem wrapping my head around Lisp. Even implementing some simple algorithms in Lisp took some time for me. I think this is due to the fact that I learned to program in C. Nowadays I work mainly with python/ruby/javascript, but I got the feeling that I…

Have you given Practical Common Lisp[1] a try? Also SICP is a very good book, albeit a big deal time commitment. You can try Fukamachi's libraries or redline6561's cl-6502 as code bases to read and play around with.

[1]:http://www.gigamonkeys.com/book/

Re: On Lisp

#72
post #24

Earlier quoted context omitted.

Sounds like you're an "anything that doesn't have static compile-time typing is dangerous" kind of guy.

Static typing is greatly beneficial, with HM it doesn't require a lot of annotation (people that use it find type annotations to be beneficial anyway). Languages that don't offer strong typing and GADTs are blub languages.

Common lisp is strongly typed, everything is of type t[1]

[1]: http://www.xach.com/naggum/articles/3284289178877169KL2065E@...

Re: On Lisp

#73

Has anyone every tried to visualize lisp with a treemap? Maybe that would take care of the massive indentation problem that makes lisp so hard to read (for me).

How large are these s-exp ? Lisp is unreadable when nested too much (I'm starring at an xml->s-exp dump and I don't even wanna try to read it), but usually lisp code and data tend to be factored into little combinators and separated specific functions. If you can, try to split them.

Re: On Lisp

#74

Any advice or link for someone new to Lisp like me? Also, is there any good open source project using Lisp that I can fork/download and tinker with? I'm still having problem wrapping my head around Lisp. Even implementing some simple algorithms in Lisp took some time for me. I think this is due to the fact that I learned to program in C. Nowadays I work mainly with python/ruby/javascript, but I got the feeling that I…

Not totally about lisp, but carries a lot of principles used in lisp (recursive types, closures), and uses scheme : http://htdp.org/

Exercises includes sorting, search in binary trees etc etc

http://mitpress.mit.edu/sicp/ is almost the same but with more math/physic background (uses numerical oriented exercises very early). You'll have to write recursive subset, n-queens, matrix-composition functions.

Re: On Lisp

#75

Any advice or link for someone new to Lisp like me? Also, is there any good open source project using Lisp that I can fork/download and tinker with? I'm still having problem wrapping my head around Lisp. Even implementing some simple algorithms in Lisp took some time for me. I think this is due to the fact that I learned to program in C. Nowadays I work mainly with python/ruby/javascript, but I got the feeling that I…

emacs

Re: On Lisp

#76
post #66
post #55

Earlier quoted context omitted.

Oh, if your goal is to learn one of the Lisps, then don't spend any time on Common Lisp. It's old and ugly. Similar, if someone asked about a modern scripting language, I'd send them away from Perl in favour of Python or Ruby. If they goal was explicitly Perl (or Common Lisp) that would be a different thing, though.

>>Oh, if your goal is to learn one of the Lisps, then don't spend any time on Common Lisp. It's old and ugly. why? I don't find that at all, and a large reason for learning common lisp is as a learning exercise to become more intimately familiar with lambda calculus and s-expressions. The increased expressivity of clojure (for example) may hinder the very thought processes that make lisp a dialect worth learning. Of…

> as a learning exercise to become more intimately familiar with lambda calculus and s-expressions

Any Scheme implementation will be better for this. Much less primitives, one namespace for everything, hygienic macros, immutablity by default/encouraged.

CL is exactly the opposite of that - it's complicated because it wants to be practical. And for the most part it is. It supports procedural, functional and OO programming, probably logic programming too with the right library. It's designed as a real system for solving real problems - and as such is not the best tool for learning about lambda calculus. Actually you could program imperatively in CL for the long time before ever feeling awkward.

Scheme, with it's mandatory TCO and encouraged immutability is much better for learning lambda calculus... and about Lisp in general.

Re: On Lisp

#77
post #68

Earlier quoted context omitted.

You seem very upset. Calm down. I just had an idea that it might be fun to represent lisp code in a treemap. Or rather a zoomable treemap like this: http://bost.ocks.org/mike/treemap/

Not upset, just tired of ignorant programmers who get off on complaining, and inventing solutions to imaginary problems (bad syntax? ooh, clever visualization!) rather than actually writing code. By the way, you didn't answer the question -- how much Lisp code have you written, "javajosh"?

Could you lay off the personal attacks?

Re: On Lisp

#78
post #55

Earlier quoted context omitted.

I'd advise exactly the opposite. While clojure and racket are excellent languages, they are very different from one another and CL. Telling someone to learn python or ruby if they ask about learning lua isn't a good advice, is it?

Oh, if your goal is to learn one of the Lisps, then don't spend any time on Common Lisp. It's old and ugly. Similar, if someone asked about a modern scripting language, I'd send them away from Perl in favour of Python or Ruby. If they goal was explicitly Perl (or Common Lisp) that would be a different thing, though.

Bullshit!

In many ways Common Lisp is still a much better language than Clojure or Racket. It isn't old, compared to pretty much anything from the 80's it has aged unbelievably well, and while it has some "stale" parts you can call ugly, I find many parts of clojure or racket much uglier. All in all, it is one of the best high level languages around.

Re: On Lisp

#79

Has anyone every tried to visualize lisp with a treemap? Maybe that would take care of the massive indentation problem that makes lisp so hard to read (for me).

How large are these s-exp ? Lisp is unreadable when nested too much (I'm starring at an xml->s-exp dump and I don't even wanna try to read it), but usually lisp code and data tend to be factored into little combinators and separated specific functions. If you can, try to split them.

Here's a link to an example of that coping strategy from some bad Clojure I wrote last night [1]. I sometimes use an accumulation of lets for a similar effect, but only when describing simpler transformations.

The lets might look like so (warning- silly example):

    (defn n-squared-over-two-plus-three-as-str [n]
      (let [squared (* n n)
            halved  (/ squared 2.0)
            added   (+ halved 3)]
        (str added)))
     
    > (n-squared-over-two-plus-three-as-str 1)
    "3.5"
Sure, I could've just done this as a deeply-nested structure:

    > ((fn [n] (str (+ 3 (#(/ % 2.0) (* n n))))) 1)
    "3.5"
... but it's harder to read, debug, and reason about. You wouldn't do that in a non-functional language either! I suppose the tolerance for deep nesting is different for different programmers.

[1] https://github.com/dpritchett/cloball/blob/62300d31666ab1261...

Re: On Lisp

#80
post #61
post #33

Earlier quoted context omitted.

But that's not the main style of programming. If you teach someone lisp he'll hack around with functions and macros and not realize that his problem could be elegantly written in constraint programming. Most of the time the majority of code (written by good programmers) is in constraints or relations, so why encase that in a functional language with parenthesis everywhere (I've programmed a fair bit in lisp and don't…

People who have problems need to know about diffrent solutions. Just forcing everybody to use some langauge that supports some of these from the ground up want change that. You want a language that is flexible to expand into new fields. Also you have still not provided with these magical programming languages you are talking about. Is there any language you yourself would use? As far as I know many concepts like cont…

(you tamp down a little with your rudeness - why would multiple decades old tech be 'magical')

Prolog with clpfd and chr, Mozart/Oz, Sql, Clips. Libraries like gecode, java choco.

There aren't any new ways of programming that have been invented. There's basically the mathematical programming (constraint/logic/relational/linear), functional, procedural, oo, concurrent, stack. You're not going to come up with something new during a session of lisp hacking. You'll just reinvent the above multiple times.

Post reply on HN