News for hackers. Stuff that matters.
Re:Can Lisp do What Perl Does Easily? by SwellJoe on Thursday September 06, 2007 @07:52PM (#51365)
Note the date. In 2000, Perl was, by far, the leading scripting language (and language for the web). I'm certain that if this rant were written today, it would target PHP, and possibly even Ruby and Python. Ironically, perhaps, modern Perl is more lisp-like than any other mainstream language (aside from JavaScript, in some ways), and so this article merely says, "Mainstream languages that come pretty close to Lisp are brain-damaged and you'd have to be a particular breed of crazy to use it for anything."
Re:Can Lisp do What Perl Does Easily? by shiro on Thursday September 06, 2007 @08:25PM (#51373)
I love his rant. There are so many colorful expressions in it that even if you don't agree with what he says, you can enjoy how he says it.

Here's another my favorite, Erik on C++, from 1998: http://groups.google.com/group/comp.lang.lisp/msg/917737b7cc...

Re:Can Lisp do What Perl Does Easily? by SwellJoe on Thursday September 06, 2007 @08:52PM (#51378)
Awesome. He's convinced that using a language (C++ or Perl, depending on the rant in question) can cause damage to ones cognitive processes! He is a colorful one.

I'm pretty sure I'd feel dumber after having worked in PHP for the past six months on our new website, if that were true.

Re:Can Lisp do What Perl Does Easily? by brlewis on Friday September 07, 2007 @11:04AM (#51713)
No, if you were succumbing to the trap he described about Perl, then you would feel smarter for having solved so many immediate problems.
Re:Can Lisp do What Perl Does Easily? by sandoh on Thursday September 06, 2007 @10:31PM (#51417)
"I actually think C++ is ideal only for programmers without any ethics."

This guy is a little bit extreme.

Re:Can Lisp do What Perl Does Easily? by omouse on Thursday September 06, 2007 @11:50PM (#51482)
and so this article merely says, "Mainstream languages that come pretty close to Lisp are brain-damaged and you'd have to be a particular breed of crazy to use it for anything."

Wrong. This reddit comment nailed it: http://programming.reddit.com/info/2mm0n/comments/c2mo30

Erik's argument is that Perl incentivizes The Wrong Way, and disincentivizes The Right Way. It's not about coercion, it's about incentives. "it's not that perl programmers are idiots, it's that the language rewards idiotic behavior in a way that no other language or tool has ever done." --jemfinch

Re:Can Lisp do What Perl Does Easily? by SwellJoe on Friday September 07, 2007 @12:06AM (#51499)
"Wrong."

Very concise. And it's always good to back it up with the assertions of some random dude on Reddit.

Re:Can Lisp do What Perl Does Easily? by omouse on Friday September 07, 2007 @12:41AM (#51508)
The assertation is backed up by a quote from the original post by Naggum. I said "wrong" because you somehow missed that part of his post. He was not saying that Perl is wrong because it has some of Lisp's features. He was saying that it is wrong because it allows shitty work. In fact, it encourages it by making it harder to write good solutions.

Someone (Perl) can be beautiful (Lisp features), but that doesn't change the fact that they wear dirty clothing (ugly syntax) and they smell kind of funny (ugly solutions).

Re:Can Lisp do What Perl Does Easily? by SwellJoe on Friday September 07, 2007 @01:23AM (#51527)
"The assertation is backed up by a quote from the original post by Naggum."

An ill-informed rant from a crank is not the same as "backed up".

"Someone (Perl) can be beautiful (Lisp features), but that doesn't change the fact that they wear dirty clothing (ugly syntax) and they smell kind of funny (ugly solutions)."

We all have our preferences.

While you can quote your favorite usenet crank from years ago, I can quote one of my favorites about Lisp (doesn't mean Lisp isn't a great language for many tasks...this quote just makes me laugh every time I read it):

"Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in." --Larry Wall ([email protected])

Smart people can disagree on many things. Programming languages are no different.

Re:Can Lisp do What Perl Does Easily? by philh on Friday September 07, 2007 @08:48AM (#51645)
>An ill-informed rant from a crank is not the same as "backed up".

Omouse isn't (directly) asserting anything about perl. He's making assertions about Naggum's assertions. For that purpose, the ill-informed rant in question is an excellent source of corroboration.

Re:Can Lisp do What Perl Does Easily? by lupin_sansei on Friday September 07, 2007 @03:08AM (#51566)
> In 2000, Perl was, by far, the leading scripting language (and language for the web).

It still is (excepting PHP)

http://www.tiobe.com/tpci.htm

Re:Can Lisp do What Perl Does Easily? by Goladus on Friday September 07, 2007 @12:32PM (#51770)
In what ways is Perl Lisp-like?

The more I learn Lisp, the less it seems like Perl at all.

Re:Can Lisp do What Perl Does Easily? by jimbokun on Friday September 07, 2007 @02:29PM (#51833)
http://www.paulgraham.com/icad.html

Scroll down to Appendix: Power.

The Perl solution is close to the Lisp solution in terms of brevity. The solution in other languages tend to be longer or the problem can't be solved at all.

Choice quote:

"In the rivalry between Perl and Python, the claim of the Python hackers seems to be that that Python is a more elegant alternative to Perl, but what this case shows is that power is the ultimate elegance: the Perl program is simpler (has fewer elements), even if the syntax is a bit uglier."

Re:Can Lisp do What Perl Does Easily? by Goladus on Friday September 07, 2007 @06:24PM (#51947)
Defining a function is only the first step. Generally, one defines a function so that it can be called. With perl, you have to use an extra symbol to specify that you're calling a function, where Python infers it if you put a parameter list. Common Lisp lets you do it either way.

Here's a hypothetical Python:

    mana=foo(100)
    mana(-10)
    mana(-15)
Here's Perl:

    $mana=foo(100);
    &$mana(-10);
    &$mana(-15);
Common Lisp:

    (setf mana (foo 100))
    (funcall mana -10)
    (funcall mana -15)
Also Common Lisp:

    (setf (symbol-function 'mana) (foo 100))
    (mana -10)
    (mana -15)
Re:Can Lisp do What Perl Does Easily? by SwellJoe on Friday September 07, 2007 @02:04PM (#51818)
Perhaps learning more Perl would solve that problem.
Re:Can Lisp do What Perl Does Easily? by Goladus on Friday September 07, 2007 @05:18PM (#51914)
Perhaps you could give me a brief summary (a few sentences) about what you mean regarding Perl's similarly to Lisp. I may simply be paying attention to different things.
Re:Can Lisp do What Perl Does Easily? by Goladus on Friday September 07, 2007 @09:58PM (#51996)
In the meantime, here are a few of the differences I've observed:

Perl flattens lists by default.

All subroutine parameters are passed via @_, resulting in an imperative-style parsing of variables at the beginning of every sub.

A perl program is a file of perl statements, a lisp program is a lisp list of expressions.

Perl has contexts.

(edit) Also, Lisp reserves almost no characters. I can use square-bracket as a symbol name if I want.

Re:Can Lisp do What Perl Does Easily? by SwellJoe on Saturday September 08, 2007 @02:53PM (#52244)
"Perl flattens lists by default."

Perl has several data types. You can get all the unflattened goodness you want by passing array refs. We do it all the time in our code. It's merely syntax.

"All subroutine parameters are passed via @_, resulting in an imperative-style parsing of variables at the beginning of every sub."

Likewise, pass an array ref, and you don't fiddle with parsing @_. TMTOWTDI.

(Note that I'm not suggesting passing array refs for everyone or all subroutines...it's just a somewhat lispy way of thinking. In OO development, a more "imperative-style" is appropriate, and we use that too.)

"A perl program is a file of perl statements, a lisp program is a lisp list of expressions."

OK. Wonderful. Nonetheless, you have first-class functions in Perl. Currying is possible (and not terribly ugly) in Perl. Closures exist in Perl.

Macros do not, yet, exist in Perl 5. But they exist in Perl 6. That's the only significant gap I'm aware of (where "significant" means, "a concept that cannot be replicated in the language without huge, long-winded, hacks"). Syntax is arbitrary, and smart people can disagree on what good syntax looks like. Power is a bit more tangible, and on the power continuum Perl holds up just fine.

"Perl has contexts."

So? Merely syntax.

"Also, Lisp reserves almost no characters. I can use square-bracket as a symbol name if I want."

Again, so?

I'm talking about power, you're talking about implementation and syntax preferences. You may feel that the beauty of Lisp is in the details, and that's wonderful. I think Lisp is nifty, too. But, there is also beauty in speed of development, and nothing is faster to develop than already written code. Perl has the largest collection of free pre-written functionality of any modern language in CPAN. It also happens that for my problem domain (system administration automation) Perl is effectively already a nearly ideal DSL.

For me, built-in grep and map and file tests and operations and regular expressions and taint mode and efficient hash tables and native Unicode and cheap enough concurrency and lots and lots of libraries are all killer features and Perl has all of them. Sure, Lisp has a better map, by some definition of better, and I can pull in a regex library and probably a POSIX file library. Erlang has better concurrency by all definitions. Other languages are strong in other areas. But nothing has them all...except Perl.

The nice thing is that we can both use our favorite languages for anything we want. I will never come over to your house and force you to write (or read!) Perl code. I promise.

I do think folks are missing out on some interesting ideas by closing their eyes and going "neener neener neener neener" with fingers in their ears every time someone mentions Perl, but that's no business of mine.

Re:Can Lisp do What Perl Does Easily? by Goladus on Monday September 10, 2007 @05:15PM (#52953)
I'm mostly trying to figure out what the essential qualities of Perl are such that you consider it more lisplike than any other language. I have in fact been trying to avoid making value judgments about either language (though I have complained about Perl in the past, and I understand the original author makes some absurd criticisms).

So: I have specified a few things that, to me, seem remarkably different from Lisp. In some cases, such features are more cumbersome or less flexible. In others, such as the reserved characters, there is no clear winner.

That Common Lisp has few if any reserved characters gives me lots of freedom to change how my program looks. In my example above, I could remap 'funcall' to '&' and the result would look almost just like Perl. It means, though, that I have to be really careful not to do anything stupid lest my program be unreadable. Perl, in contrast, has built-in meanings for all sorts of punctuation. This often saves a lot of typing, and allows many ideas to be expressed succinctly without any extraneous configuration So Lisp is more flexible in a sense, but it's not immediately clear that this makes Lisp more powerful.

What I'm interested in, is how much different it is to program in lisp as compared to perl. The symbols thing seems minor in principle. But in practice, when coding in Lisp I find this flexibility leads to a completely different way of thinking. It's way too early for me to say whether one is better than the other, but the difference is remarkable.

merely syntax

Perl is full of syntax. There's syntax for everything, personally I think it's one of Perl's strengths. Lisp, in contrast, (usually) has very little syntax. It's orthogonal and consistent. (limited and static, if you'd prefer more negative connotations)

Some people do better memorizing huge number of details, others do better learning core rules and applying them to each case. In my first year of music theory, my professor took the "few core rules, consistently applied" approach to teaching voice-leading and almost everyone hated it. The first day of class next semester, my new professor handed out a voice-leading review sheet that was, front-and-back, covered with rules about what to do in a given context. Most people seemed to prefer it that way.

Re:Can Lisp do What Perl Does Easily? by SwellJoe on Monday September 10, 2007 @07:38PM (#53020)
"I'm mostly trying to figure out what the essential qualities of Perl are such that you consider it more lisplike than any other language."

Not any other language. Merely any other mainstream language aside from possibly JavaScript (which is very nearly Scheme with C-style syntax).

It actually doesn't sound like we disagree on much other than what makes a language Lisp-like. ;-)

I'm primarily concerned with the "blub" and "power continuum" concepts that pg came up with. Any language lower on the power continuum is blub, and if you're only familiar with blub you can't see why a language higher up is more powerful. My basic assertion is that Perl has much more room below it on the power continuum than above it, with pretty much just Lisp (and other macro-capable functional languages) being clearly above it. Perl 6 introduces macros, so the picture changes a little bit come Christmas (or whenever the first Perl 6 is released).

And, I agree that syntax is a huge gaping difference between Lisp and Perl. But Lisp is hugely different from all other mainstream languages in that regard, as well, so it has to be canceled out, as far as I'm concerned. So, once syntax as a difference in removed, all you have is "what concepts can you implement readily in this language", and Perl has pretty much everything except macros. Most other mainstream languages are missing some number of others.