For Programmers: Free Programming Magazines  


Home > Archive > Scheme > May 2005 > Language documentation ( was Re: Computing Industry shams)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Language documentation ( was Re: Computing Industry shams)
vermicule

2005-05-08, 3:58 am

"Xah Lee" <xah@xahlee.org> writes:

> A|B, where A and B can be arbitrary REs, creates a regular expression
> that will match either A or B. An arbitrary number of REs can be
> separated by the "|" in this way. This can be used inside groups (see
> below) as well. As the target string is scanned, REs separated by "|"
> are tried from left to right. When one pattern completely matches, that
> branch is accepted. This means that once A matches, B will not be
> tested further, even if it would produce a longer overall match. In
> other words, the "|" operator is never greedy. To match a literal "|",
> use \|, or enclose it inside a character class, as in [|].
>
> --end quote--
>
> Note: In other words, the "|" operator is never greedy.
>
> Note the need to inject the high-brow jargon "greedy"here as a
> latch on sentence.


What is so hard to understand ?
Should be perfectly clear even to a first year undergraduate.

As for "greedy" even a minimal exposure to Djikstra's shortest path
algorithm would have made the concept intuitive. And from memory,
that is the sort of thing done in Computing 101 and in Data Structures and
Algorithms 101

It seems to me that you want the Python doc to be written for morons.
And that is not a valid complaint.
Måns Rullgård

2005-05-08, 3:58 am

vermicule <rambam@bigpond.net.au> writes:

> "Xah Lee" <xah@xahlee.org> writes:


[...]

>
> It seems to me that you want the Python doc to be written for morons.


Not for morons, but for trolls. Don't feed them.

--
Måns Rullgård
mru@inprovide.com
alex goldman

2005-05-08, 8:57 pm

vermicule wrote:

>
> What is so hard to understand ?
> Should be perfectly clear even to a first year undergraduate.
>
> As for "greedy" even a minimal exposure to Djikstra's shortest path
> algorithm would have made the concept intuitive. And from memory,
> that is the sort of thing done in Computing 101 and in Data Structures
> and Algorithms 101
>
> It seems to me that you want the Python doc to be written for morons.
> And that is not a valid complaint.


He's right actually. If we understand the term "greedy" as it's used in
graph search and optimization algorithms, Python's RE matching actually IS
greedy.

Sean Burke

2005-05-09, 8:59 pm


alex goldman <hello@spamm.er> writes:

> vermicule wrote:
>
>
> He's right actually. If we understand the term "greedy" as it's used in
> graph search and optimization algorithms, Python's RE matching actually IS
> greedy.


No, you're just about the optimization metric.
In regexes, "greedy" match optimizes for the longest match,
not the fastest.

And this is common regex terminology - man perlre and you will
find discussion of "greedy" vs. "stingy" matching.

-SEan

alex goldman

2005-05-10, 4:00 pm

Sean Burke wrote:

>
> alex goldman <hello@spamm.er> writes:
>
>
> No, you're just about the optimization metric.
> In regexes, "greedy" match optimizes for the longest match,
> not the fastest.
>
> And this is common regex terminology - man perlre and you will
> find discussion of "greedy" vs. "stingy" matching.


Read what you quoted again. Everyone (Xah, vermicule, myself) was talking
about "greedy" as it's used in graph search and optimization algorithms.
Lawrence Kirby

2005-05-10, 4:00 pm

On Tue, 10 May 2005 04:58:48 -0700, alex goldman wrote:

> Sean Burke wrote:


....

>
> Read what you quoted again. Everyone (Xah, vermicule, myself) was talking
> about "greedy" as it's used in graph search and optimization algorithms.


However the original quote was in the context of regular expressions, so
discussion of the terminology used in regular expressions is far more
relevant than the terminology used in graph search and optimisation
algorithms.

Lawrence
alex goldman

2005-05-10, 4:00 pm

Lawrence Kirby wrote:

> On Tue, 10 May 2005 04:58:48 -0700, alex goldman wrote:
>
>
> ...
>
>
> However the original quote was in the context of regular expressions, so
> discussion of the terminology used in regular expressions is far more
> relevant than the terminology used in graph search and optimisation
> algorithms.


I replied to "And from memory, that is the sort of thing done in Computing
101 and in Data Structures and Algorithms 101", and I fully explained what
I meant by "greedy" as well. There was no ambiguity.
Lawrence Kirby

2005-05-10, 4:00 pm

On Tue, 10 May 2005 06:52:18 -0700, alex goldman wrote:

> Lawrence Kirby wrote:


....

>
> I replied to "And from memory, that is the sort of thing done in Computing
> 101 and in Data Structures and Algorithms 101", and I fully explained what
> I meant by "greedy" as well. There was no ambiguity.


My response talks about relevance, not ambiguity.

Lawrence

alex goldman

2005-05-10, 4:00 pm

Lawrence Kirby wrote:

> On Tue, 10 May 2005 06:52:18 -0700, alex goldman wrote:
>
>
> ...
>
>
> My response talks about relevance, not ambiguity.


Well, your response was irrelevant.
Keith Thompson

2005-05-10, 8:59 pm

alex goldman <hello@spamm.er> writes:
> Lawrence Kirby wrote:

[snip]
>
> Well, your response was irrelevant.


This entire discussion is irrelevant to most, if not all, of the
newsgroups to which it's being posted. comp.lang.c, where I'm reading
this, is for discussion of the C programming language; I see nothing
about C.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com