From: ccc31807 on
On February 27, in a thread on c.l.l, RG had this to say about Perl:
<quote>
>> But Perl is just an
>> abomination through-and-through. I do not deny that many people find it
>> a productive tool, and about ten years ago having developed a certain
>> level of respect for some of those people I determined to learn Perl
>> just to see what those people got out of it. So I picked up a Perl
>> book, but I could not get past the first few chapters without recoiling
>> in revulsion. It was just horrible.
</quote>
I wanted to reply but also wanted to take some time to think about my
reply.

Yesterday, I wrote a typical data munging script using Perl. I was
using two hashes, %sec and %fac, and needed to populate the 'location'
value in %fac with the value in %sec depending on the state of the
'xlist' key in %sec. The code looks horrible, but I think any
journeyman programmer can follow the logic even if he doesn't
understand Perl or the data structures. This is the code, and I might
add that it's working code:

<code>
if ($sec{$k}{'xlist'} !~ /\d/)
{ $fac{$sec{$k}{'id1'}}{'location'} = $sec{$k}{'site'}; }
elsif ($sec{$k}{'xlist'} eq $sec{$k}{'crs_id'})
{ $fac{$sec{$k}{'id1'}}{'location'} = $sec{$k}{'site'}; }
else
{ $fac{$sec{$k}{'id1'}}{'location'} = $sec{$sec{$k}{'xlist'}}
{'site'}; }
</code>

In David Lamkins' book 'Successful Common Lisp' in chapter 4, we find
the following. This also looks horrible, and I don't think a
journeyman programmer can follow this logic unless he knew something
about Lisp.

<quote>
The following piece of code illustrates how you can use the same name
for different purposes. Take a minute to read this, and see how many
separate uses you can count for the name FUNNY.

(defun funny (funny)
"funny..."
(if (zerop funny)
:funny
(list
(cons funny
(let ((funny funny))
(setq funny (1- funny))
(funny funny)))
funny)))

Here are the five roles played by this one name:

1. function name
2. function argument
3. a word in the documentation string
4. a constant in the keyword package
5. a new lexical variable
</quote>

Perl uses sigils ($, !, %, &) to signify a token's usage. Lisp uses
positional notation for the same thing. It's not that one's bad and
one's not -- it's just cosmetic. It's as if one language is wearing a
pinstripe suit with wing tips and the other is wearing a blue blazer
with penny loafers. Underneath, the logic is the same in both
languages, and once you get past the peculiarities of the language you
use the same logic. (I'm not arguing that the power of the languages
is the same, in several respects Lisp is more powerful than Perl, but
that the process of thinking through a problem is the same.)

Here's the point: to call one language horrible and an abomination
because you don't understand it, and ignoring the horribleness and the
abominable in another language because you do understand it, doesn't
make any sense. The cover doesn't make the book the clothes don't make
the man, and the appearance doesn't make the language. Instead, a
language should be judged on the work that it permits, and in this
respect (based on surveys like TIOBE and advertised positions) Perl
seems to be a lot more useful (and perhaps a lot less horrible) than
CL.

One language isn't better or worse that the other, they are just
different, and the expression of RG's opinion is simply a value
judgment, which others may or may not share.

CC.
From: Tim Bradshaw on
On 2010-03-10 15:01:14 +0000, ccc31807 said:

> This is the code, and I might
> add that it's working code:
>
> <code>
> if ($sec{$k}{'xlist'} !~ /\d/)
> { $fac{$sec{$k}{'id1'}}{'location'} = $sec{$k}{'site'}; }
> elsif ($sec{$k}{'xlist'} eq $sec{$k}{'crs_id'})
> { $fac{$sec{$k}{'id1'}}{'location'} = $sec{$k}{'site'}; }
> else
> { $fac{$sec{$k}{'id1'}}{'location'} = $sec{$sec{$k}{'xlist'}}
> {'site'}; }
> </code>

I write quire a lot of Perl, and I'd have to look at that pretty hard
to know what it did. Mostly this is probabl because of really
catastrophically bad layout.

>
> In David Lamkins' book 'Successful Common Lisp' in chapter 4, we find
> the following. This also looks horrible, and I don't think a
> journeyman programmer can follow this logic unless he knew something
> about Lisp.

That's because (as you know) it is intentionally a pathological
example: it's not *meant* to be easy to understand. It says no more
aout Lisp than this code:

(defun recurse-over (object node-test node-function child-test mapper)
      (let ((f #'(lambda (o c)
                   (when (funcall node-test o)
                     (funcall node-function o))
                   (when (funcall child-test o)
                     (funcall mapper #'(lambda (e)
                                         (funcall c e c))
                              o)))))
        (funcall f object f)))
    (defun sum-evens (nested-list)
      (let ((sum 0))
        (recurse-over nested-list
                      #'(lambda (e)
                          (and (numberp e) (evenp e)))
                      #'(lambda (e)
                          (setf sum (+ sum e)))
                      #'listp
                      #'mapc)
        sum))

You are doing a good job of blowing your own feet off here.

From: Tamas K Papp on
On Wed, 10 Mar 2010 07:01:14 -0800, ccc31807 wrote:

> (defun funny (funny)
> "funny..."
> (if (zerop funny)
> :funny
> (list
> (cons funny
> (let ((funny funny))
> (setq funny (1- funny))
> (funny funny)))
> funny)))
>
> Here are the five roles played by this one name:
>
> 1. function name
> 2. function argument
> 3. a word in the documentation string 4. a constant in the keyword
> package
> 5. a new lexical variable

You mean that you can use something as a variable name, and then use
the same letters as part of a string? Gosh, Common Lisp must be Pure
Madness!

But more seriously, you completely misunderstand Common Lisp when you
write "roles played by this ONE NAME" (my emphasis). It is _not_ one
name.

Your post actually highlights some similarities between Perl and CL:
both have various namespaces, once you see through the thin layer of
syntax for accessing these. So your feeble attempt at starting a
flamewar is pretty... funny.

Tamas
From: ccc31807 on
On Mar 10, 10:46 am, Tamas K Papp <tkp...(a)gmail.com> wrote:
> So your feeble attempt at starting a flamewar is pretty... funny.

Not my intent to start a flame war. Please reread my post.

> Here's the point: to call one language horrible and an abomination
> because you don't understand it, and ignoring the horribleness and the
> abominable in another language because you do understand it, doesn't
> make any sense.

CC
From: Tamas K Papp on
On Wed, 10 Mar 2010 07:53:28 -0800, ccc31807 wrote:

> On Mar 10, 10:46 am, Tamas K Papp <tkp...(a)gmail.com> wrote:
>> So your feeble attempt at starting a flamewar is pretty... funny.
>
> Not my intent to start a flame war. Please reread my post.

Yeah, sure. Cross-posting something like this usually promotes peace
and happiness.

>> Here's the point: to call one language horrible and an abomination
>> because you don't understand it, and ignoring the horribleness and the
>> abominable in another language because you do understand it, doesn't
>> make any sense.

You failed to show anything horrible or abominable in CL. All you
demonstrated was your confusion (but that was done pretty well,
congrats).

Cheers,

Tamas