all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* For text processing, which is more powerful, emacs or perl?
@ 2020-12-19  7:43 Hongyi Zhao
  2020-12-19  9:00 ` Jean Louis
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-19  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

It's well known that perl's regexp is very powerful for its capability
of text processing. So, which is more powerful, emacs or perl, in this
scenario?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19  7:43 For text processing, which is more powerful, emacs or perl? Hongyi Zhao
@ 2020-12-19  9:00 ` Jean Louis
  2020-12-19 12:17   ` Hongyi Zhao
  2020-12-19 16:01 ` Stefan Monnier
  2021-10-08 16:52 ` Marcin Borkowski
  2 siblings, 1 reply; 27+ messages in thread
From: Jean Louis @ 2020-12-19  9:00 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

* Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-19 10:44]:
> It's well known that perl's regexp is very powerful for its capability
> of text processing. So, which is more powerful, emacs or perl, in this
> scenario?

Well it is better to tell what you wish to achieve. What kind of text
do you wish to process?

I was doing many command line processing with Perl, importing data
with Perl, processing text, importing into databases, processing large
programs. It is more for command line processing and programmatic
processing.

Today I do those things with Emacs Lisp so I import CSV data, process
entries, insert into databases. I do not miss Perl today. Emacs Lisp
seem to me simpler now than Perl back then.

You may evaluate this function below:

(info "(elisp) Regular Expressions")

Then research regular expressions in Emacs.

With Emacs I can process in real time and by watching on screen what
is happening. I can undo the process if I made a mistake.

You may use any tools. Including you may combine tools.



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19  9:00 ` Jean Louis
@ 2020-12-19 12:17   ` Hongyi Zhao
  2020-12-19 12:25     ` Jean Louis
  2020-12-19 14:36     ` Harald Jörg
  0 siblings, 2 replies; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-19 12:17 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs

On Sat, Dec 19, 2020 at 5:16 PM Jean Louis <bugs@gnu.support> wrote:
>
> * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-19 10:44]:
> > It's well known that perl's regexp is very powerful for its capability
> > of text processing. So, which is more powerful, emacs or perl, in this
> > scenario?
>
> Well it is better to tell what you wish to achieve. What kind of text
> do you wish to process?
>
> I was doing many command line processing with Perl, importing data
> with Perl, processing text, importing into databases, processing large
> programs. It is more for command line processing and programmatic
> processing.
>
> Today I do those things with Emacs Lisp so I import CSV data, process
> entries, insert into databases. I do not miss Perl today. Emacs Lisp
> seem to me simpler now than Perl back then.
>
> You may evaluate this function below:
>
> (info "(elisp) Regular Expressions")
>
> Then research regular expressions in Emacs.
>
> With Emacs I can process in real time and by watching on screen what
> is happening. I can undo the process if I made a mistake.
>
> You may use any tools. Including you may combine tools.

1. What about use emacs as an IDE to debug perl code?
2. Nowadays, it seems that many packages on cpan cannot be updated in
time like those packages on pypi for python, so I think whether this
means that Perl is obsolete.
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 12:17   ` Hongyi Zhao
@ 2020-12-19 12:25     ` Jean Louis
  2020-12-20  0:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-08 16:42       ` Marcin Borkowski
  2020-12-19 14:36     ` Harald Jörg
  1 sibling, 2 replies; 27+ messages in thread
From: Jean Louis @ 2020-12-19 12:25 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

* Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-19 15:18]:
> > You may use any tools. Including you may combine tools.
> 
> 1. What about use emacs as an IDE to debug perl code?
> 2. Nowadays, it seems that many packages on cpan cannot be updated in
> time like those packages on pypi for python, so I think whether this
> means that Perl is obsolete.

  You may use Emacs to debug perl code, I guess it is M-x cperl-mode

  CPAN and Perl are not obsolete, not at all.

  Jean
  



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 12:17   ` Hongyi Zhao
  2020-12-19 12:25     ` Jean Louis
@ 2020-12-19 14:36     ` Harald Jörg
  2020-12-20  4:38       ` Jean Louis
  1 sibling, 1 reply; 27+ messages in thread
From: Harald Jörg @ 2020-12-19 14:36 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs, Jean Louis

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> On Sat, Dec 19, 2020 at 5:16 PM Jean Louis <bugs@gnu.support> wrote:
>>
>> * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-19 10:44]:
>> > It's well known that perl's regexp is very powerful for its capability
>> > of text processing. So, which is more powerful, emacs or perl, in this
>> > scenario?
>>
>> Well it is better to tell what you wish to achieve. What kind of text
>> do you wish to process?
>>
>> I was doing many command line processing with Perl, importing data
>> with Perl, processing text, importing into databases, processing large
>> programs. It is more for command line processing and programmatic
>> processing.
>>
>> Today I do those things with Emacs Lisp so I import CSV data, process
>> entries, insert into databases. I do not miss Perl today. Emacs Lisp
>> seem to me simpler now than Perl back then.

Regarding regular expressions, Perl is still ahead of Emacs: It has
zero-with assertions (sort of 'looking-at' within a regexp),
"possessive" matches which help avoiding exponential backtracking times,
named captures to make long regexps more readable, and more.  That also
underlines your point: This excels for programmatic processing, it is
not that important for interactive use.

> [... snip ...}
>
> 1. What about use emacs as an IDE to debug perl code?

M-x perldb and off you go!

The advantages in comparison to debugging on the terminal are that Emacs
shows the source code while you're debugging, and it has a practically
unlimited output buffer, so you can dump large structures.  And then,
you can use Emacs' capabilities to search and navigate through the
output.  That's not specific to Perl, of course.

> 2. Nowadays, it seems that many packages on cpan cannot be updated in
> time like those packages on pypi for python, so I think whether this
> means that Perl is obsolete.

I don't understand that statement: https://metacpan.org/recent shows
some dozens updates per day.  Perl itself regularly gets a new version
each year.

For Emacs as an editor, the (inofficial) survey
https://emacssurvey.org/2020/ has a slide titled "If you use Emacs for
programming, which languages do you program in"?.  This gives some
evidence: Python is more popular, but Perl isn't obsolete.
-- 
Cheers,
haj



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19  7:43 For text processing, which is more powerful, emacs or perl? Hongyi Zhao
  2020-12-19  9:00 ` Jean Louis
@ 2020-12-19 16:01 ` Stefan Monnier
  2020-12-20  5:23   ` Jean Louis
  2020-12-20  9:01   ` tomas
  2021-10-08 16:52 ` Marcin Borkowski
  2 siblings, 2 replies; 27+ messages in thread
From: Stefan Monnier @ 2020-12-19 16:01 UTC (permalink / raw)
  To: help-gnu-emacs

> It's well known that perl's regexp is very powerful for its capability
> of text processing. So, which is more powerful, emacs or perl, in this
> scenario?

Probably Snobol or Icon.


        Stefan




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 12:25     ` Jean Louis
@ 2020-12-20  0:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-20  1:42         ` Hongyi Zhao
  2020-12-20  3:03         ` Hongyi Zhao
  2021-10-08 16:42       ` Marcin Borkowski
  1 sibling, 2 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-20  0:04 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis wrote:

> CPAN and Perl are not obsolete, not at all

Today most people will turn to Python instead of Perl for
solving a general task. Development in Python is very fast and
the code is to the untrained eye easier to read than Perl code
which has a more cryptic and esoteric style.

But that doesn't mean Perl is obsolete and people will still
use it for many years to come.

For Emacs there should be many alternatives and packages that
deal with Perl code. `perl-mode' is built-in (defined in
perl-mode.el.gz), you get that when you open a .pl file.

Interestingly, while Perl feels old, and Python pretty new,
the difference is only 4 years: Perl is from 1987,
Python 1991.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  0:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-20  1:42         ` Hongyi Zhao
  2020-12-20  3:07           ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-20  5:31           ` Jean Louis
  2020-12-20  3:03         ` Hongyi Zhao
  1 sibling, 2 replies; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-20  1:42 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sun, Dec 20, 2020 at 8:04 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Jean Louis wrote:
>
> > CPAN and Perl are not obsolete, not at all
>
> Today most people will turn to Python instead of Perl for
> solving a general task. Development in Python is very fast and
> the code is to the untrained eye easier to read than Perl code
> which has a more cryptic and esoteric style.
>
> But that doesn't mean Perl is obsolete and people will still
> use it for many years to come.
>
> For Emacs there should be many alternatives and packages that
> deal with Perl code. `perl-mode' is built-in (defined in
> perl-mode.el.gz), you get that when you open a .pl file.
>
> Interestingly, while Perl feels old, and Python pretty new,
> the difference is only 4 years: Perl is from 1987,
> Python 1991.

The performance penalty is the largest bottleneck of Python code. It
can be seen from the following minimal example:

werner@X10DAi:~$ time python3 --version >/dev/null

real    0m0.086s
user    0m0.065s
sys    0m0.027s
werner@X10DAi:~$ time perl --version >/dev/null

real    0m0.003s
user    0m0.003s
sys    0m0.000s



> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>


-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  0:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-20  1:42         ` Hongyi Zhao
@ 2020-12-20  3:03         ` Hongyi Zhao
  2020-12-20  3:11           ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-20  3:03 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sun, Dec 20, 2020 at 8:04 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Jean Louis wrote:
>
> > CPAN and Perl are not obsolete, not at all
>
> Today most people will turn to Python instead of Perl for
> solving a general task. Development in Python is very fast and
> the code is to the untrained eye easier to read than Perl code
> which has a more cryptic and esoteric style.

Although with that said, it's an indisputable fact that the top 1
capability for text-based regex processing capability is still belongs
to Perl.

>
> But that doesn't mean Perl is obsolete and people will still
> use it for many years to come.
>
> For Emacs there should be many alternatives and packages that
> deal with Perl code. `perl-mode' is built-in (defined in
> perl-mode.el.gz), you get that when you open a .pl file.
>
> Interestingly, while Perl feels old, and Python pretty new,
> the difference is only 4 years: Perl is from 1987,
> Python 1991.
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>


-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  1:42         ` Hongyi Zhao
@ 2020-12-20  3:07           ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-20  5:31           ` Jean Louis
  1 sibling, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-20  3:07 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> The performance penalty is the largest bottleneck of Python
> code. It can be seen from the following minimal example:

Yes, Perl is faster in execution than Python but it is often
not about speed anymore as Python is fast enough, so rather
the speed/cost of learning, development and maintenance, and
the availability of up-to-date packs, are perhaps (I'm not
sure) areas were it is either a close fight or Python even
excels...

I've written an IRC bot in Python [1] and, knowing nothing
about Python, I understood and could write it
almost instantly. So development is fast in Python, even to
a total beginner.

I also did some irssi scripts in Perl [2] - this was before
I switched to ERC as my IRC client [3] - but I have no
memories from that because it was so long ago. So maybe
development is fast in Perl as well :)

[1] https://dataswamp.org/~incal/#bot
[2] https://dataswamp.org/~incal/irssi/scripts/
[3] https://dataswamp.org/~incal/emacs-init/erc-my.el

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  3:03         ` Hongyi Zhao
@ 2020-12-20  3:11           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-20  3:11 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> Although with that said, it's an indisputable fact that the
> top 1 capability for text-based regex processing capability
> is still belongs to Perl.

Well, use Perl then, from Emacs :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 14:36     ` Harald Jörg
@ 2020-12-20  4:38       ` Jean Louis
  0 siblings, 0 replies; 27+ messages in thread
From: Jean Louis @ 2020-12-20  4:38 UTC (permalink / raw)
  To: Harald Jörg; +Cc: help-gnu-emacs, Hongyi Zhao

* Harald Jörg <haj@posteo.de> [2020-12-19 17:37]:
> > 1. What about use emacs as an IDE to debug perl code?
> 
> M-x perldb and off you go!

Interesting, I would not know it.



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 16:01 ` Stefan Monnier
@ 2020-12-20  5:23   ` Jean Louis
  2020-12-20  6:17     ` Hongyi Zhao
  2020-12-20 13:58     ` Stefan Monnier
  2020-12-20  9:01   ` tomas
  1 sibling, 2 replies; 27+ messages in thread
From: Jean Louis @ 2020-12-20  5:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

* Stefan Monnier <monnier@iro.umontreal.ca> [2020-12-19 19:02]:
> > It's well known that perl's regexp is very powerful for its capability
> > of text processing. So, which is more powerful, emacs or perl, in this
> > scenario?
> 
> Probably Snobol or Icon.

Thank you. Very interesting resource:
https://www2.cs.arizona.edu/icon/




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  1:42         ` Hongyi Zhao
  2020-12-20  3:07           ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-20  5:31           ` Jean Louis
  2020-12-20  6:18             ` Hongyi Zhao
  1 sibling, 1 reply; 27+ messages in thread
From: Jean Louis @ 2020-12-20  5:31 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs, Emanuel Berg

* Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 04:43]:
> werner@X10DAi:~$ time python3 --version >/dev/null
> 
> real    0m0.086s
> user    0m0.065s
> sys    0m0.027s
> werner@X10DAi:~$ time perl --version >/dev/null
> 
> real    0m0.003s
> user    0m0.003s
> sys    0m0.000s

You did not measure the code, rather startup time to show the version.



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  5:23   ` Jean Louis
@ 2020-12-20  6:17     ` Hongyi Zhao
  2020-12-20  6:25       ` Jean Louis
  2020-12-20 13:58     ` Stefan Monnier
  1 sibling, 1 reply; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-20  6:17 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs, Stefan Monnier

On Sun, Dec 20, 2020 at 1:27 PM Jean Louis <bugs@gnu.support> wrote:
>
> * Stefan Monnier <monnier@iro.umontreal.ca> [2020-12-19 19:02]:
> > > It's well known that perl's regexp is very powerful for its capability
> > > of text processing. So, which is more powerful, emacs or perl, in this
> > > scenario?
> >
> > Probably Snobol or Icon.
>
> Thank you. Very interesting resource:
> https://www2.cs.arizona.edu/icon/
>

At the first glimpse, I just think you're kidding me considering that
I've never heard languages names like them. After some digging with
google, I find the GitHub repos of them:

https://github.com/gtownsend/icon
https://github.com/hardbol/spitbol/

But it seems that both of them are languages with very small user groups.
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  5:31           ` Jean Louis
@ 2020-12-20  6:18             ` Hongyi Zhao
  2020-12-20  6:52               ` Jean Louis
  0 siblings, 1 reply; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-20  6:18 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs, Emanuel Berg

On Sun, Dec 20, 2020 at 1:31 PM Jean Louis <bugs@gnu.support> wrote:
>
> * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 04:43]:
> > werner@X10DAi:~$ time python3 --version >/dev/null
> >
> > real    0m0.086s
> > user    0m0.065s
> > sys    0m0.027s
> > werner@X10DAi:~$ time perl --version >/dev/null
> >
> > real    0m0.003s
> > user    0m0.003s
> > sys    0m0.000s
>
> You did not measure the code, rather startup time to show the version.

https://perlmaven.com/compare-the-speed-of-perl-and-python-regex

-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  6:17     ` Hongyi Zhao
@ 2020-12-20  6:25       ` Jean Louis
  0 siblings, 0 replies; 27+ messages in thread
From: Jean Louis @ 2020-12-20  6:25 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs, Stefan Monnier

* Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 09:18]:
> On Sun, Dec 20, 2020 at 1:27 PM Jean Louis <bugs@gnu.support> wrote:
> >
> > * Stefan Monnier <monnier@iro.umontreal.ca> [2020-12-19 19:02]:
> > > > It's well known that perl's regexp is very powerful for its capability
> > > > of text processing. So, which is more powerful, emacs or perl, in this
> > > > scenario?
> > >
> > > Probably Snobol or Icon.
> >
> > Thank you. Very interesting resource:
> > https://www2.cs.arizona.edu/icon/
> >
> 
> At the first glimpse, I just think you're kidding me considering that
> I've never heard languages names like them. After some digging with
> google, I find the GitHub repos of them:
> 
> https://github.com/gtownsend/icon
> https://github.com/hardbol/spitbol/
> 
> But it seems that both of them are languages with very small user
> groups.

It is very high level programming language easy to understand. My
biggest problem with it is that it does not support Unicode.

That there are user groups, I don't know, I would not need it. It has
enough libraries and is well documented language with books available,
and provides easy graphics support.

It is excellent for learning programming how I see it.



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  6:18             ` Hongyi Zhao
@ 2020-12-20  6:52               ` Jean Louis
  2020-12-20  7:49                 ` Hongyi Zhao
  0 siblings, 1 reply; 27+ messages in thread
From: Jean Louis @ 2020-12-20  6:52 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs, Emanuel Berg

* Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 09:19]:
> On Sun, Dec 20, 2020 at 1:31 PM Jean Louis <bugs@gnu.support> wrote:
> >
> > * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 04:43]:
> > > werner@X10DAi:~$ time python3 --version >/dev/null
> > >
> > > real    0m0.086s
> > > user    0m0.065s
> > > sys    0m0.027s
> > > werner@X10DAi:~$ time perl --version >/dev/null
> > >
> > > real    0m0.003s
> > > user    0m0.003s
> > > sys    0m0.000s
> >
> > You did not measure the code, rather startup time to show the version.
> 
> https://perlmaven.com/compare-the-speed-of-perl-and-python-regex

I see, yes, it cannot compare well to Python. So for when speed is
critical it is better using Perl. Perl is/was one of my favorite
languages and I did everything in Perl before learning about Lisp.

Lisp offers to me better simpler readability.

What I am missing is simple interface and that is solved with Emacs
built-in features. And Emacs than provides instability so I cannot
really solve huge tasks with it, it crashes, has memory problems,
etc.




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  6:52               ` Jean Louis
@ 2020-12-20  7:49                 ` Hongyi Zhao
  2020-12-20 13:42                   ` Jean Louis
  0 siblings, 1 reply; 27+ messages in thread
From: Hongyi Zhao @ 2020-12-20  7:49 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs, Emanuel Berg

On Sun, Dec 20, 2020 at 2:56 PM Jean Louis <bugs@gnu.support> wrote:
>
> * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 09:19]:
> > On Sun, Dec 20, 2020 at 1:31 PM Jean Louis <bugs@gnu.support> wrote:
> > >
> > > * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 04:43]:
> > > > werner@X10DAi:~$ time python3 --version >/dev/null
> > > >
> > > > real    0m0.086s
> > > > user    0m0.065s
> > > > sys    0m0.027s
> > > > werner@X10DAi:~$ time perl --version >/dev/null
> > > >
> > > > real    0m0.003s
> > > > user    0m0.003s
> > > > sys    0m0.000s
> > >
> > > You did not measure the code, rather startup time to show the version.
> >
> > https://perlmaven.com/compare-the-speed-of-perl-and-python-regex
>
> I see, yes, it cannot compare well to Python. So for when speed is
> critical it is better using Perl. Perl is/was one of my favorite
> languages and I did everything in Perl before learning about Lisp.
>
> Lisp offers to me better simpler readability.
>
> What I am missing is simple interface and that is solved with Emacs
> built-in features. And Emacs than provides instability so I cannot
> really solve huge tasks with it, it crashes, has memory problems,
> etc.

Really? If so, why emacs is still the most preferred editor for top
developers on the world?
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic Vocational and Technical University
NO. 552 North Gangtie Road, Xingtai, China



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 16:01 ` Stefan Monnier
  2020-12-20  5:23   ` Jean Louis
@ 2020-12-20  9:01   ` tomas
  1 sibling, 0 replies; 27+ messages in thread
From: tomas @ 2020-12-20  9:01 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

On Sat, Dec 19, 2020 at 11:01:52AM -0500, Stefan Monnier wrote:
> > It's well known that perl's regexp is very powerful for its capability
> > of text processing. So, which is more powerful, emacs or perl, in this
> > scenario?
> 
> Probably Snobol or Icon.

Tcl ;-P

While somewhat tongue-in-cheek, I have some (by now older) reference to
back it [1]. The gist is that Tcl actually implements Thompson's clever
strategy (NFA -> power set DFA, yadda, yadda), while the P* languages
(Perl, Python, PHP, Ruby... to me, they are quite similar, all of them
[2]) all seem to use backtracking implementations. They do have a more
convenient (and strictly more powerful!) RE language, but they do pay
the price in terms of the occassional exponential runaway [3].

Now to the tongue-in-cheek part: Tcl has evolved since [1] (which was
around 2007) -- as have the other P*s. Among other things, I hear that 
they have overhauled their regexpery (which is something awe-inspiring:
most projects, once they have a regexp engine in them, DON'T TOUCH IT.
Too much black magic and forgotten lore in there :-) But Tcl folks are
like that.

Perhaps Tcl cas chosen the "convenience" path, and their regexp engine
resembles more that of the P*s these days.

Cheers

[1] "Regular Expression Matching Can Be Simple And Fast
     (but is slow in Java, Perl, PHP, Python, Ruby, ...)"
    <https://swtch.com/~rsc/regexp/regexp1.html>

[2] But I do enjoy (a limited amount) of those bragging contests
    "My Python is better  than your Perl, nyah, nyah". They tickle
    the hobby anthropoligist in me ;-)

[3] This afforded me a job asignment a long, long time ago

 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  7:49                 ` Hongyi Zhao
@ 2020-12-20 13:42                   ` Jean Louis
  0 siblings, 0 replies; 27+ messages in thread
From: Jean Louis @ 2020-12-20 13:42 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs, Emanuel Berg

* Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 10:50]:
> On Sun, Dec 20, 2020 at 2:56 PM Jean Louis <bugs@gnu.support> wrote:
> >
> > * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 09:19]:
> > > On Sun, Dec 20, 2020 at 1:31 PM Jean Louis <bugs@gnu.support> wrote:
> > > >
> > > > * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-20 04:43]:
> > > > > werner@X10DAi:~$ time python3 --version >/dev/null
> > > > >
> > > > > real    0m0.086s
> > > > > user    0m0.065s
> > > > > sys    0m0.027s
> > > > > werner@X10DAi:~$ time perl --version >/dev/null
> > > > >
> > > > > real    0m0.003s
> > > > > user    0m0.003s
> > > > > sys    0m0.000s
> > > >
> > > > You did not measure the code, rather startup time to show the version.
> > >
> > > https://perlmaven.com/compare-the-speed-of-perl-and-python-regex
> >
> > I see, yes, it cannot compare well to Python. So for when speed is
> > critical it is better using Perl. Perl is/was one of my favorite
> > languages and I did everything in Perl before learning about Lisp.
> >
> > Lisp offers to me better simpler readability.
> >
> > What I am missing is simple interface and that is solved with Emacs
> > built-in features. And Emacs than provides instability so I cannot
> > really solve huge tasks with it, it crashes, has memory problems,
> > etc.
> 
> Really? If so, why emacs is still the most preferred editor for top
> developers on the world?

What I do is not really editing, it is harvesting data and entering
into database without pause. So it blocks Emacs while doing it.

Most of times Emacs is handling what I want.

But I will most probably delegate some tasks to Erlang language or
Common Lisp.



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20  5:23   ` Jean Louis
  2020-12-20  6:17     ` Hongyi Zhao
@ 2020-12-20 13:58     ` Stefan Monnier
  2020-12-20 14:47       ` tomas
  1 sibling, 1 reply; 27+ messages in thread
From: Stefan Monnier @ 2020-12-20 13:58 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs

>> > It's well known that perl's regexp is very powerful for its capability
>> > of text processing. So, which is more powerful, emacs or perl, in this
>> > scenario?
>> Probably Snobol or Icon.
> Thank you. Very interesting resource:
> https://www2.cs.arizona.edu/icon/

Maybe a more modern contender would be OMeta https://en.wikipedia.org/wiki/OMeta


        Stefan




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-20 13:58     ` Stefan Monnier
@ 2020-12-20 14:47       ` tomas
  0 siblings, 0 replies; 27+ messages in thread
From: tomas @ 2020-12-20 14:47 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

On Sun, Dec 20, 2020 at 08:58:20AM -0500, Stefan Monnier wrote:

[...]

> Maybe a more modern contender would be OMeta https://en.wikipedia.org/wiki/OMeta

Ugh. Yet another rabbit hole. Must... control... browser... of... death :)

Thank you!

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19 12:25     ` Jean Louis
  2020-12-20  0:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-08 16:42       ` Marcin Borkowski
  1 sibling, 0 replies; 27+ messages in thread
From: Marcin Borkowski @ 2021-10-08 16:42 UTC (permalink / raw)
  To: Jean Louis; +Cc: help-gnu-emacs, Hongyi Zhao


On 2020-12-19, at 13:25, Jean Louis <bugs@gnu.support> wrote:

> * Hongyi Zhao <hongyi.zhao@gmail.com> [2020-12-19 15:18]:
>> > You may use any tools. Including you may combine tools.
>> 
>> 1. What about use emacs as an IDE to debug perl code?
>> 2. Nowadays, it seems that many packages on cpan cannot be updated in
>> time like those packages on pypi for python, so I think whether this
>> means that Perl is obsolete.
>
>   You may use Emacs to debug perl code, I guess it is M-x cperl-mode
>
>   CPAN and Perl are not obsolete, not at all.

Well, nor is COBOL...

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2020-12-19  7:43 For text processing, which is more powerful, emacs or perl? Hongyi Zhao
  2020-12-19  9:00 ` Jean Louis
  2020-12-19 16:01 ` Stefan Monnier
@ 2021-10-08 16:52 ` Marcin Borkowski
  2021-10-09  1:42   ` Hongyi Zhao
  2 siblings, 1 reply; 27+ messages in thread
From: Marcin Borkowski @ 2021-10-08 16:52 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


On 2020-12-19, at 08:43, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> It's well known that perl's regexp is very powerful for its capability
> of text processing. So, which is more powerful, emacs or perl, in this
> scenario?

While others offered free jokes and musings about performance (which is
usually irrelevant unless you process multi-gigabyte files, craft
malicious regexen or do something extremely complicated), let me mention
something that wasn't mentioned in this thread (or so I think).

Perl (or Python, or whatever "mainstream" language you take) usually
processes texts in a traditional way, using strings and regexen.  Emacs,
OTOH, is a text editor, with all its concepts, so you may process texts
using buffers, which differ from strings in one important respect: the
notion of /point/.  (There are other differences, too, e.g., buffers are
usually more performant.)  This means that you can write code that
processes text like a human editor would do, in terms of "moving the
point a word forward, transposing two sentences, deleting from point to
the end of line" etc.

It's much like the difference between classical graphical operations
(draw a point, a line segment between two points, a circle with given
center and radius etc.) and turtle graphics known from LOGO.

I'm not saying that the Emacs way is definitely better - that probably
depends on the context and the nature of your text processing - but you
might find it quite intuitive and easier, both in implementing and in
studying existing code (when you e.g. need to improve something you
wrote 6 months earlier and you remember nothing about the
implementation).  What is the point of having unreadable code running in
2 milliseconds instead of clear and easy to understand code running in
even 200 milliseconds when you don't want to run it a million times, but
you need to modify it from time to time?

Hth,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2021-10-08 16:52 ` Marcin Borkowski
@ 2021-10-09  1:42   ` Hongyi Zhao
  2021-10-10 14:26     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 27+ messages in thread
From: Hongyi Zhao @ 2021-10-09  1:42 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: help-gnu-emacs

On Sat, Oct 9, 2021 at 12:53 AM Marcin Borkowski <mbork@mbork.pl> wrote:
>
>
> On 2020-12-19, at 08:43, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > It's well known that perl's regexp is very powerful for its capability
> > of text processing. So, which is more powerful, emacs or perl, in this
> > scenario?
>
> While others offered free jokes and musings about performance (which is
> usually irrelevant unless you process multi-gigabyte files, craft
> malicious regexen or do something extremely complicated), let me mention
> something that wasn't mentioned in this thread (or so I think).
>
> Perl (or Python, or whatever "mainstream" language you take) usually
> processes texts in a traditional way, using strings and regexen.  Emacs,
> OTOH, is a text editor, with all its concepts, so you may process texts
> using buffers, which differ from strings in one important respect: the
> notion of /point/.  (There are other differences, too, e.g., buffers are
> usually more performant.)  This means that you can write code that
> processes text like a human editor would do, in terms of "moving the
> point a word forward, transposing two sentences, deleting from point to
> the end of line" etc.
>
> It's much like the difference between classical graphical operations
> (draw a point, a line segment between two points, a circle with given
> center and radius etc.) and turtle graphics known from LOGO.
>
> I'm not saying that the Emacs way is definitely better - that probably
> depends on the context and the nature of your text processing - but you
> might find it quite intuitive and easier, both in implementing and in
> studying existing code

But lisp - any lisp dialects - is much more obscure than python to
some extent. Of course, perl regexp and syntax is also known for being
difficult to understand.

> (when you e.g. need to improve something you
> wrote 6 months earlier and you remember nothing about the
> implementation).  What is the point of having unreadable code running in
> 2 milliseconds instead of clear and easy to understand code running in
> even 200 milliseconds when you don't want to run it a million times, but
> you need to modify it from time to time?
>
> Hth,
>
> --
> Marcin Borkowski
> http://mbork.pl



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: For text processing, which is more powerful, emacs or perl?
  2021-10-09  1:42   ` Hongyi Zhao
@ 2021-10-10 14:26     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-10 14:26 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> But lisp - any lisp dialects - is much more obscure than
> python

Don't know the context of this remark, but it is
absolutely true.

> perl regexp and syntax is also known for being difficult
> to understand.

If you don't know either Perl or Python, so you don't have any
emotional attachments to either, go for Python for
several reasons.

The people who are into Perl are actually starting to become
like us in the obscureness sense ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2021-10-10 14:26 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-19  7:43 For text processing, which is more powerful, emacs or perl? Hongyi Zhao
2020-12-19  9:00 ` Jean Louis
2020-12-19 12:17   ` Hongyi Zhao
2020-12-19 12:25     ` Jean Louis
2020-12-20  0:04       ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20  1:42         ` Hongyi Zhao
2020-12-20  3:07           ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-20  5:31           ` Jean Louis
2020-12-20  6:18             ` Hongyi Zhao
2020-12-20  6:52               ` Jean Louis
2020-12-20  7:49                 ` Hongyi Zhao
2020-12-20 13:42                   ` Jean Louis
2020-12-20  3:03         ` Hongyi Zhao
2020-12-20  3:11           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-08 16:42       ` Marcin Borkowski
2020-12-19 14:36     ` Harald Jörg
2020-12-20  4:38       ` Jean Louis
2020-12-19 16:01 ` Stefan Monnier
2020-12-20  5:23   ` Jean Louis
2020-12-20  6:17     ` Hongyi Zhao
2020-12-20  6:25       ` Jean Louis
2020-12-20 13:58     ` Stefan Monnier
2020-12-20 14:47       ` tomas
2020-12-20  9:01   ` tomas
2021-10-08 16:52 ` Marcin Borkowski
2021-10-09  1:42   ` Hongyi Zhao
2021-10-10 14:26     ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.