Re: [clisp-list] RPM with REGEXP

Grzegorz Chrupala <grechru@...> writes:
> --- Sam Steingold <sds@...> escribi=F3: > > * In
> message
> > where did you get the RPM?
> > please do complain to the distributor!
>=20
> Mandrake Linux.
>=20
> 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 ;)
>=20
> Cheers,
> Greg
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
--=20
-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

Thread view

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

Grzegorz Chrupala <grechru@...> writes:
> 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
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

> * In message <20020723085805.75843.qmail@...>
> * On the subject of "[clisp-list] RPM with REGEXP"
> * Sent on Tue, 23 Jul 2002 10:58:05 +0200 (CEST)
> * Honorable Grzegorz Chrupala <grechru@...> writes:
>
> I am trying to learn Lisp and as my first language is
> Perl I am used to using regexps for pattern matching.
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&gt;
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
> build for Linux, compiled with regexp?
The usual places, e.g.,
<http://sourceforge.net/project/showfiles.php?group_id=1355&gt;
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&gt; <http://www.iris.org.il&gt; <http://www.memri.org/&gt;
<http://www.mideasttruth.com/&gt; <http://www.palestine-central.com/links.html&gt;
Whom computers would destroy, they must first drive mad.

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.
> Well, regexps are very limited in what can be
> accomplished with them.
> (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.
> 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.
I am reading "On Lisp" now and enjoying it.
> Feel free to rip perl regexps from perl and make a
> CLISP module.
Not my level yet, I'm afraid.
> install the RPM and run clisp as
>
> $ clisp -K full
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: grechru@...
tel: (+34)669321477
_______________________________________________________________
Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis!
Descárgalo ya desde http://es.messenger.yahoo.com

> * In message <20020724081307.12494.qmail@...>
> * On the subject of "Re: [clisp-list] RPM with REGEXP"
> * Sent on Wed, 24 Jul 2002 10:13:07 +0200 (CEST)
> * Honorable Grzegorz Chrupala <grechru@...> writes:
>
> > Well, regexps are very limited in what can be
> > accomplished with them.
> > (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;
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.
> > $ clisp -K full
>
> 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.
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&gt; <http://www.iris.org.il&gt; <http://www.memri.org/&gt;
<http://www.mideasttruth.com/&gt; <http://www.palestine-central.com/links.html&gt;
The only guy who got all his work done by Friday was Robinson Crusoe.

--- Sam Steingold <sds@...> escribió: > > * In
message
> where did you get the RPM?
> 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
_______________________________________________________________
Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis!
Descárgalo ya desde http://es.messenger.yahoo.com

Grzegorz Chrupala <grechru@...> writes:
> --- Sam Steingold <sds@...> escribi=F3: > > * In
> message
> > where did you get the RPM?
> > please do complain to the distributor!
>=20
> Mandrake Linux.
>=20
> 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 ;)
>=20
> Cheers,
> Greg
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
--=20
-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

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details