Language documentation ( was Re: Computing Industry shams)

V

vermicule

Xah Lee said:
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.
 
?

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

vermicule said:
[...]


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.
 
A

alex goldman

vermicule said:
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.
 
?

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

alex goldman said:
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.

If we, more reasonably, use the meaning of "greedy" that is commonly
used when talking about regular expressions, there is nothing wrong
with the Python docs, and Xah Lee remains the troll he has always
been.
 
S

Sean Burke

alex goldman said:
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 confused 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
 
A

alex goldman

Sean said:
No, you're just confused 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.
 
A

alex goldman

Lawrence said:
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.
 
L

Lawrence Kirby

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
 
L

Lawrence Kirby

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
 
K

Keith Thompson

alex goldman said:
Lawrence Kirby wrote: [snip]
My response talks about relevance, not ambiguity.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top