Subject: [clisp-list] RPM with REGEXP

From: Grzegorz Chrupala <[email-masked]>
Date: Tue Jul 23 01:59:02 2002

Hi All

I am trying to learn Lisp and as my first language is
Perl I am used to using regexps for pattern matching.
I would like to continue using them with CLISP. I
tried to build CLISP myself (with the regexp module)
but didn't manage to. Question is, is there a binary
build for Linux, compiled with regexp?

Thanks,

Gregor

_______________________________________________________________
Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis! 
Descárgalo ya desde http://es.messenger.yahoo.com

---

From: Marco Baringer <[email-masked]>
Date: Tue Jul 23 03:36:03 2002

> build for Linux, compiled with regexp?

1) why couldn't you build the regexp module? 

2) there are pure lisp regexp packages which do not require rebuilding
   CLISP. Go to the Regular Expression section on the Cliki:

   http://ww.telent.net/cliki/Regular%20Expression

   pregexp is slow but is the most perl like. Michael Parker's is fast
   and feature complete enough to be very usefull (the only feature i
   miss are zero-wdith positive/negative look ahead/behind assertions,
   but those can usually be faked anyway).

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen

---

From: Sam Steingold <[email-masked]>
Date: Tue Jul 23 06:10:03 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] RPM with REGEXP"
> * Sent on Tue, 23 Jul 2002 10:58:05 +0200 (CEST)
> * Honorable Grzegorz Chrupala <[email-masked]> writes:
>

Well, regexps are very limited in what can be accomplished with them.
(e.g., they are not "Turing complete").
I urge you to explore the power of functional and OO programming
instead of writing Perl code in Common Lisp syntax.
Get Paul Grahams "ANSI Common Lisp" and "On Lisp" and read them.
You will not regret the investment.

> I would like to continue using them with CLISP.

Note that CLISP uses the standard POSIX regexp format (same as egrep and
Emacs) and not the Perl regexp format.
<http://clisp.cons.org/impnotes.html#regexp>
Feel free to rip perl regexps from perl and make a CLISP module.

> I tried to build CLISP myself (with the regexp module)
> but didn't manage to.

what was your problem?

> Question is, is there a binary

The usual places, e.g.,
<http://sourceforge.net/project/showfiles.php?group_id=1355>
install the RPM and run clisp as

$ clisp -K full

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Whom computers would destroy, they must first drive mad.

---

From: Grzegorz Chrupala <[email-masked]>
Date: Wed Jul 24 01:14:02 2002

Many thanks to peaple who answered me!
> 1) why couldn't you build the regexp module? 
The problem wasn't specifically with the regexp
module.  I tried to bulid CLISP and when I ran 'make',
after a while it started complaining about undefined
references. The last couple of lines:

terminal.o(.text+0x8ae): undefined reference to
`tputs'
collect2: ld returned 1 exit status
make: *** [lisp.run] Error 1

>    pregexp is slow but is the most perl like.
Thanks for suggesting it, I am trying it now.

> Michael Parker's is fast
I am still figuring out how to use it.

> (e.g., they are not "Turing complete").

They are still useful for simple pattern matching and
for scripting, aren't they?
That is what I have to do most of the time; I thought
if I did some of it in Lisp I would learn faster than
just by reading a book.

> Get Paul Grahams "ANSI Common Lisp" and "On Lisp"

I am reading "On Lisp" now and enjoying it.

> Feel free to rip perl regexps from perl and make a

Not my level yet, I'm afraid.

> install the RPM and run clisp as

I did this but didn't get REGEXP. In my installation
the full/ and the base/ directory contain exactly the
same files (same name, same size) so I guess my RPM
wasn't built with additional modules.

Gregor

=====

Grzegorz Chrupala
c/ Portal Nou 40, 1, 2
E-08003 Barcelona
España/Spain
webpage: geocities.com/grechru
e-mail: [email-masked]
tel: (+34)669321477

---

From: Sam Steingold <[email-masked]>
Date: Wed Jul 24 13:55:04 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] RPM with REGEXP"
> * Sent on Wed, 24 Jul 2002 10:13:07 +0200 (CEST)
> They are still useful for simple pattern matching and for scripting,
> aren't they?  That is what I have to do most of the time;

nope!
Consider a simple task: finding out file name extension.
In perl you would write:

$ext = ($filename =~ s/.*\.([^\.]*)$/\1/);

(or some other unreadable stuff like that).
In Lisp you would write

(setq ext (pathname-type filename))

or, to avoid accusations that CL has something built-in :-)

(setq ext (subseq filename (1+ (position #\. filename :from-end))))

note that the CL expression is much more clear.

(it is also longer, which can be either advantage or disadvantage,
depending on your personal taste; I can enter it must faster with Emacs
than the corresponding Perl expression.  Also, note that due to the
basic information theory laws, the more concise the language is, the
easier it is to make a simple typo that will be detected only at
run-time).

> I thought if I did some of it in Lisp I would 
> learn faster than just by reading a book.

Sure.

> wasn't built with additional modules.

where did you get the RPM?
please do complain to the distributor!

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
The only guy who got all his work done by Friday was Robinson Crusoe.

---

From: Grzegorz Chrupala <[email-masked]>
Date: Thu Jul 25 00:47:05 2002

--- Sam Steingold <[email-masked]> escribió: > > * In
message
> please do complain to the distributor!

Mandrake Linux.

Now I have grabbed the latest RPM from Sourceforge and
it does contain REGEXP. But maybe I wont use it after
all, if you are right about Lisp not needing any
stinking regexen ;)

Cheers,
Greg

---

From: Marco Baringer <[email-masked]>
Date: Thu Jul 25 02:06:02 2002

> all, if you are right about Lisp not needing any

it is just a question of the right tool for the right job. if you want
to manipulate filenames (pathnames) then you should not use regexps,
CL's pathname data type offers a far better (ie cleaner and more
generic) way to do it. however, if you are parsing some text and you
want to determine if the data is of a particular form then regexps are
the way to go, this is what regexps were invented for and they do this
job well. yes they can be abused (perl's /e modifier is the root of a
lot of evil) but not for this reason they should be avoided.

my EUR0.02