
Why Lisp is Awesome - floater
http://atomized.org/2009/01/why-lisp-is-awesome/
======
rntz
This isn't why Lisp is awesome. This is why Lisp _was_ awesome, back 50 years
ago. Every single one of these features has since been adopted by mainstream
scripting languages. What still sets Lisp apart is its metalinguistic
capability - macros (hygienic or not).

~~~
ieure
I was specifically writing about features Lisp pioneered which other languages
adopted. I think it's enlightening to understand the roots and history of
things, and fint it amazing that such an old language pioneered so many
fundamental constructs.

Perhaps by 2059, we'll have languages with macros and regular syntax.

~~~
jodrellblank
> Perhaps by 2059, we'll have languages with macros and regular syntax.

Boo has macros ... <http://boo.codehaus.org/Language+Guide> (at the end, under
'advanced features'.

~~~
lispm
C has macros.

------
scott_s
Nitpick: "dyanmic programming" does not meant what you think it means.
<http://en.wikipedia.org/wiki/Dynamic_programming>

------
vicaya
Risking being downmodded, I'd say Lisp is too "low level" for many common
problems, which is great if your domain is parser/compiler
construction/transformation/combination. I have no problem with lisp syntax (I
can even tolerate C++ templates :), but it (and most general purpose
languages) feels less natural for many domain specific problems than languages
catering to the domains.

A DSL family based on a flexible core (with a lispish intermediate language
even) might be a viable approach.

In many situations, simplicity and restrictions (constraints) in DSLs is
better than flexibility and expressiveness in a general purpose language,
because it can offer new possibilities for domain specific optimizations due
to domain specific constraints.

Just like new notations in math led to breakthroughs in many math branches,
new syntax can bring new life to software in many specific domains.

The key to such systems seems to be making DSLs easy to build and optimize
using a suite of common building blocks (human (cs people) friendly
intermediate languages (like lisp as opposed to VM byte codes) and libraries.)

~~~
lispm
That's why Lisp was called 'AI assembler'. Literally hundreds of higher-level
languages have been implemented on top of Lisp. One of those has been
integrated into Common Lisp: CLOS, a high-level object-oriented language for
programming dynamic systems, with meta-programming capabilities.

~~~
vicaya
Most of these "high-level" languages are more of "extensions" (CLOS certainly
feels like an extension) or alternative lispish languages than bona fide DSLs
with DS constraints (that can be used for DS optimizations). The S-expression
syntax feels foreign/messy in many domains.

~~~
lispm
Languages on top of Lisp can be all from extensions, to languages with their
own syntax, parser, compiler, ...

Examples for "high-level" languages on top of Lisp:

Macsyma, Axiom, Refine, AP5, RacerPro, CycL, NESL, Reduce, PVS, the original
ML, ...

For a Lisp-like example see PDDL (Planning Domain Definition Language):

    
    
        (define (domain hanoi-domain)
                (:requirements :equality)
                (:predicates (disk ?x) (smaller ?x ?y) (on ?x ?y) (clear ?x))
                (:action move-disk
                 :parameters (?disk ?below-disk ?new-below-disk)
                 :precondition (and (disk ?disk)
                                    (smaller ?disk ?new-below-disk)
                                    (not (= ?new-below-disk ?below-disk))
                                    (not (= ?new-below-disk ?disk))
                                    (not (= ?below-disk ?disk))
                                    (on ?disk ?below-disk)
                                    (clear ?disk)
                                    (clear ?new-below-disk))
                 :effect (and (clear ?below-disk)
                              (on ?disk ?new-below-disk)
                              (not (on ?disk ?below-disk))
                              (not (clear ?new-below-disk)))))
    

Tools like these are widely used in logistics domains, one of the domains
where Lisp has been widely used. There is a competition between planning
systems and PDDL is being used to describe the problems.

For a non-s-expression domain specific language on top of Lisp see for example
PWGL. It uses a graphical language. Also Macsyma/Maxima, and many many many
others.

------
sokoloff
If anyone misses Geocities or myspace, look at this site in IE. I'm not sure
what exactly the point of (seemingly) intentionally making your blog site
readable in FF and outrageously hard to read in IE is...

~~~
ieure
I got tired of fixing layouts in IE and decided it would be more fun to break
it instead.

~~~
sokoloff
That's certainly one approach.

From the outside, my interpretation of that is "I don't value my own opinion
enough to make it accessible to users of other extremely common browsers."

I assume you blog because you feel like you have something to say that's worth
reading. Making that content inaccessible to a very large segment of the
browsers/users in the world works contrary to that. (I do sympathize with the
PITA factor.)

------
chollida1
I wasn't aware you could use const char pointers in switch statements.

switch (var) {

    
    
        case "foo":
            printf("foo block.");
            break;
    
        case "bar":
            printf("bar block.");
            break;
    
        default:
            printf("Default case")
    }

~~~
mbrubeck
You can't:

$ cat foo.c

    
    
        #include <stdio.h>
        main() {
            const char *foo = "bar";
            switch (foo) {
                case "foo":
                    printf("foo\n");
            }
        }
    

$ gcc -pedantic -std=c99 foo.c -o foo

    
    
        foo.c: In function ‘main’:
        foo.c:4: error: switch quantity not an integer
        foo.c:5: error: case label does not reduce to an integer constant

~~~
chollida1
Sorry to make you put in so much work.

I'm aware that you can't do this.

I guess my sarcasm didn't translate:)

------
DrJokepu
Many of these features are actually quite common in other languages. For
example, C# has lambdas, functions as first class objects, closures, dynamic
programming, null coalescence etc. The real power of Lisp in my opinion is not
the existence of these features but the way they perfectly fit into the
S-Expression syntax.

~~~
abstractbill
Right. Mainstream languages have been gradually evolving towards Lisp but
until they adopt a simple uniform syntax they won't get real macros, which I
think is the biggest difference between Lisp and other languages today.

~~~
DrJokepu
I believe that appreciating Lisp's minimalistic, tree-like syntax requires a
very mathematical way of thinking. Many (perhaps most) developers have a
different way of thinking. There's nothing wrong with that, diversity is a
good thing but because of that, I don't think that the S-Expression syntax
will ever become "mainstream".

~~~
lispm
It is already.

XML is full of prefix, nested syntax.

~~~
abstractbill
Yes, but nobody would seriously write a programming language that used XML for
its syntax.

~~~
lispm
So you say existing XML-based programming languages were 'written' by non-
serious people?

'Water':

    
    
        <defmethod test_true source=required="ek_string"> 
         <try <if> source.<execute_string/>.<not/>   
                     <concat "Busted: "source/>.<print/>
                   else “OK”
              </if>
        
           >
          <concat "Errored: " source/>.<print/>
         </try>
       </defmethod>
    

See also XSLT, XL, RuleML, ...

~~~
abstractbill
_So you say existing XML-based programming languages were 'written' by non-
serious people?_

Whether or not the people who wrote (sorry, I guess "designed" is the more
appropriate word) these languages were serious, I do believe they are a dead-
end.

------
yuan
The "switch statement" in C is closer to the CASE macro[1] in Lisp.

[1]:
[http://www.lispworks.com/documentation/HyperSpec/Body/m_case...](http://www.lispworks.com/documentation/HyperSpec/Body/m_case_.htm)

------
clueless123
For the longest time I've heard that "Lisp is awesome", but no reasons why and
when I've asked why, the answer is usually, "you have to try it to see it"

This article is a pretty nice down to earth point by point explanation why
list is so cool. My question is: is that it ? lambdas, data is code, dynamic
programing.. I mean those features are cool, but could someone post some more
clear examples of why lisp is awesome?

~~~
asolove
See the HN-famous books "Structure and Interpretation of Computer Programs,"
"Paradigms of Artificial Intelligence Programming," and "On Lisp."

The claim is that Lisp is a language at a higher level of abstraction. You
will have to study hard to be able to appreciate that level, but it cannot be
explained in another way.

Imagine explaining Calculus to a high school Physics student. You're likely to
get back: "But I can find the acceleration of an object by using normal
algebra and subtracting its position at two different times!" Calculus is
hard, its benefits are not clearly better than approximation or high school
algebra until you reach a level at which you brain thinks of Calculus as
fundamental and sees the old equations as merely derived, less-powerful
versions.

Why would you expect a mind-expanding language to be any easier to explain?

~~~
clueless123
Dude... that is a _very_ good analogy! point well taken.

~~~
silentbicycle
Also, it's worth noting that all three books implement a subset of Prolog (in
Lisp). Prolog is another language which sounds really bizarre, but can be
incredibly powerful. It's less general purpose than Lisp, though -
essentially, it works by searching for answers that fulfill all criteria you
specify, backtracking to (lazily) generate alternative answers as needed. It's
conceptually really cool, and is great for prototyping certain kinds of
problems. Some of the literature is also quite good, particularly _The Art of
Prolog_ by Sterling & Shapiro.

------
d0m
Instead of cond, you can use a switch.. it makes it even more succinct. I
don't know why this post is rated so high thought.. it's like a copy of the
preface of any scheme book.

------
Locke1689
That switch statement doesn't work. You can't compare pointers(?) and string
literals like that.

------
wendroid
I'm not declaring the awesomeness or otherwise of Lisp but you're a shitty C
coder :)

