[lug] XEmacs quoting madness!

Tkil tkil at scrye.com
Mon Aug 20 18:54:09 MDT 2001


>>>>> "dajo" == David <dajo at frii.com> writes:

dajo> [...] so I decided to write your example using my lisp library
dajo> of regexp tools just to see what happened.  Now I do not expect
dajo> you to like this, nobody else does;

ha ha!  :)

dajo> but I thought you might find it interesting.  For me the
dajo> advantages are that I do not have to fight the escaping stuff
dajo> again (I did it once); and I do not have to re-learn things that
dajo> I have forgotten; and the outcome is that I make far fewer
dajo> errors.

fair enough.  i've gone both ways; i end up finding that perl is dense
enough to do what i want without writing another interface layer --
and, for me, writing good interfaces is *hard* -- so i usually do
without.

to put another way, i see the value in your little language -- but
it's *another* language that i'd have to learn.  then again, given
that i like perl, the fact that i like the extreme terseness of
regexps is hardly surprising...

dajo> This is evaluated code from my scratch buffer; yours first.
dajo> Normally I do not put in the comments at the ends of the lines;
dajo> the theory is that the function names are descriptive enough.

*nod*  a lot of lisp programmers tend that way, and i don't have any
particular quibble with it.  i find that my brain works better with
the mostly-procedural format of perl; perl does offer a few, very
powerful, list-processing functions that let me do the occasional
cascade in a lispy style...

| # hooray for schwartzian transforms!
| my @cat_order =
|   map { $_->[0] }
|     sort { $b->[1] <=> $a->[1] || $a->[0] cmp $b->[0] }
|       grep { $_->[1] >= 0 }
|         map
|         {
|             my $ci = $INFO->{category}->{$_};
|             my $priority = $ci && $ci->{display} ? $ci->{display}->[0]
|                                                  : 0;
|             [ $_, $priority ]
|         }
|           keys %valid_products;

an interesting comparison between lisp and perl solutions to the same
problem.  it's cast as a sort of "programming contest" problem; if you
want to try your hand at it, in whatever language you like, don't read
the problem statement (or any of our solutions!) until you have a few
hours free to work on it.:

   http://www-aig.jpl.nasa.gov/public/home/gat/ftp/study.txt

my perl solution:

   http://slinky.scrye.com/~tkil/perl/phonecode

and a lisp solution:

   http://www.norvig.com/java-lisp.html




More information about the LUG mailing list