Live data from Hacker News

The Nature of Lisp

defmacro.org

1–10 of 82 posts

Re: The Nature of Lisp

#2
I found that a rather good introduction to code as data, but I am not sure whether I am supposed to have been hit by the enlightenment he describes… :-)

Re: The Nature of Lisp

#3
To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful.

But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.

Re: The Nature of Lisp

#4
post #2

I found that a rather good introduction to code as data, but I am not sure whether I am supposed to have been hit by the enlightenment he describes… :-)

Yes, for me the first time I read about the lisp syntax I was thinking:

"oh cool, it makes (+ 2 2) exactly equivalent to the syntaxic tree

     +

  /     \

 2       2
"

But I don't find it particularly enlightening and I still don't see what cool stuff you can do with macros that you can't do elsewhere.

Re: The Nature of Lisp

#5
post #3

To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.

Common Lisp != Lisp. You mean Common Lisp, Lisp is the family of languages (which also includes the Scheme sub-family, Racket, Clojure, Arc, Kernel…).

Re: The Nature of Lisp

#6
post #3

To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.

I am admittedly still a Lisp (et. al.) rookie, but isn't the entire point of Scheme that it introduces hygienic macros? Or are you referring to some other (perhaps sarcastic) notion of macro hygiene?

Re: The Nature of Lisp

#7
post #4
post #2

I found that a rather good introduction to code as data, but I am not sure whether I am supposed to have been hit by the enlightenment he describes… :-)

Yes, for me the first time I read about the lisp syntax I was thinking: "oh cool, it makes (+ 2 2) exactly equivalent to the syntaxic tree + / \ 2 2 " But I don't find it particularly enlightening and I still don't see what cool stuff you can do with macros that you can't do elsewhere.

Syntactic abstraction usually requires a language change. For example, Python's "with" statement.

In languages with macros, you don't need to wait for anyone to change the language because the entirety of the language is constructed from a few special operators, and you have the ability to continue constructing.

Like Python, Clojure has a "with-open" macro. If Rich hadn't already added it, you could build it yourself:

    ; Very simplified version
    (defmacro with-open [bindings & body]
     `(let ~bindings
        (try
          ~@body
          (finally (.close ~(first bindings))))))
Thus this:

    (with-open [in (reader "/usr/share/dict/words")]
      (count (line-seq in)))
Expands into this:

    (clojure.core/let [in (reader "/usr/share/dict/words")]
      (try
        (count (line-seq in))
        (finally (.close in))))

Re: The Nature of Lisp

#8
post #5
post #3

To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.

Common Lisp != Lisp. You mean Common Lisp, Lisp is the family of languages (which also includes the Scheme sub-family, Racket, Clojure, Arc, Kernel…).

Its disingenuous to call scheme and racket lisps. They have parenthesis and first class functions but the similarities stop there.

So yes I equate Lisp with common lisp. I didn't read the entire article (far too long) but he does mention 'defmacro' which is in Common Lisp.

Re: The Nature of Lisp

#9
Very good article, though I doubt it'll convince the usual mass of unbelievers. (I love Lisp, for the record, though my primary exposure has been through Emacs Lisp - so shoot me).

A really great book that helps you get appreciate the concepts in Lisp, without really talking about Lisp directly too much, is "Patterns of Software" by Peter Gabriel. http://amzn.to/TxDKGG

I found it to be a very enlightening read. Definitely a book you have to sink into with plenty of time and quiet.

Re: The Nature of Lisp

#10
post #3

To understand Lisp is to understand interpreters. With that understanding you can create domain specific languages which is extremely powerful. But I wouldn't recommend using Lisp itself.. macros in particular are unhygienic.

You can do cool stuff with unhygienic macros, however, like anaphoric macros. Interested readers should check out On Lisp by Paul Graham, as well as Let Over Lambda by Doug Hoyte.
Post reply on HN