![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Am 19.07.2012 12:53, schrieb Invisible:
> Imagine if instead, somebody had written
>
> oneOf "sh"
> char 'd'
> letter
>
> You don't even need to know which parsing library or what programming
> language this is to figure out that it matches three characters. (Or
> maybe do you. It's perhaps not /completely/ obvious what the final line
> does.) There's barely anything to learn.
It will become less obvious as soon as the example becomes non-trivial.
>> If you want to complain about perl, then complain about perl.
>
> Have I ever mentioned that I also really hate Perl?
>
> Of course, the only reason that anybody ever uses Perl is because it has
> built-in regex support. This, together with low-level text munging, is
> literally ALL PERL DOES! >_<
... which maybe is because that's what it was /designed/ for? :-P
The only thing I know about Perl though is that its support for calling
existing C libraries dearly sucks: You cannot, for the sake of your
life, pass a NULL pointer.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>>>>> dmesg | egrep '(s|h)d[a-z]'
>>>>
>>>> If you want to build your straw man, at least use examples that conform
>>>> to your straw man. That's a bad example because it can be understood in
>>>> about 2 seconds.
>>
>>> OK, so what does it do?
>>
>> I can't believe that you are arguing that a regex is complicated because
>> you have never used regexes and don't understand their syntax.
>>
>> Imagine this:
>>
>> A: "Haskell sucks. It's really hard to understand!"
>> B: "How much Haskell have you ever written?"
>> A: "I once tried to write one small program but couldn't figure it out."
>> B: "Right."
>>
>> Don't complain about the complexity of a syntax if you haven't even
>> learned the syntax.
>
> Imagine if instead, somebody had written
>
> oneOf "sh"
> char 'd'
> letter
>
> You don't even need to know which parsing library or what programming
> language this is to figure out that it matches three characters. (Or
> maybe do you. It's perhaps not /completely/ obvious what the final line
> does.) There's barely anything to learn.
Actually it's not obvious that the three statements are actually
supposed to be applied to the same string or that it must match all three.
It might be a tad more readable than a regular expression, but it's not
inherently more obvious what it does. Having nothing but english words
instead of various puctuation signs does not guarantee clarity. Case in
point:
=IF(AND(OR(UPPER(LEFT(A1,1))="S"),UPPER(LEFT(A1,1))="H"),UPPER(MID(A1,2,1))="D",NOT(ISERROR(SEARCH(MID(A1,3,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")))))
(I hope I didn't mess up my parentheses!)
>
> It's a lot more typing, of course. But personally, that doesn't bother me.
>
>>> Come on, regexes are the number one use-case for the entire Perl
>>> programming language.
>>
>> If you want to complain about perl, then complain about perl.
>
> Have I ever mentioned that I also really hate Perl?
>
> Of course, the only reason that anybody ever uses Perl is because it has
> built-in regex support. This, together with low-level text munging, is
> literally ALL PERL DOES! >_<
Yes, and a all a hammer does is push (and in some cases pull) on nails.
It doesn't mean that a hammer is not useful, or the best tool for that
particular job.
Text munging is a big part of many people's lives. (If you consider
sysadmins to be people, of course)
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>
>
=IF(AND(OR(UPPER(LEFT(A1,1))="S"),UPPER(LEFT(A1,1))="H"),UPPER(MID(A1,2,1))="D",NOT(ISERROR(SEARCH(MID(A1,3,1),"ABCDEFGHIJKLMNOPQRSTUVWXYZ")))))
>
>
> (I hope I didn't mess up my parentheses!)
I didn't mess up my parentheses, but forgot to put
,"Hard disk is on fire",""
before the last parenthesis.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> Having nothing but english words
> instead of various puctuation signs does not guarantee clarity.
No. But it can help a lot. I won't have to go look up what my code
snippet does if I come back to it in 6 months' time.
>> Have I ever mentioned that I also really hate Perl?
>>
>> Of course, the only reason that anybody ever uses Perl is because it has
>> built-in regex support. This, together with low-level text munging, is
>> literally ALL PERL DOES! >_<
>
> Yes, and a all a hammer does is push (and in some cases pull) on nails.
> It doesn't mean that a hammer is not useful, or the best tool for that
> particular job.
>
> Text munging is a big part of many people's lives. (If you consider
> sysadmins to be people, of course)
The thing is, text munging is fundamentally /wrong/. It's something that
should be avoided at all costs. So an entire language designed to
perform a task that you shouldn't perform in the first place...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 7/19/2012 3:53, Invisible wrote:
> oneOf "sh"
> char 'd'
> letter
>
> You don't even need to know which parsing library or what programming
> language this is to figure out that it matches three characters.
Really? I would not have guessed that "one of sh" means "one of the
characters in the string" vs "one instance of the string 'sh'"
> Of course, the only reason that anybody ever uses Perl is because it has
> built-in regex support. This, together with low-level text munging, is
> literally ALL PERL DOES! >_<
It's a report generation language. It's right in the name. What did you
expect? Did you ever read any RPG (Report Program Generator) code?
--
Darren New, San Diego CA, USA (PST)
"Oh no! We're out of code juice!"
"Don't panic. There's beans and filters
in the cabinet."
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> oneOf "sh"
>> char 'd'
>> letter
>>
>> You don't even need to know which parsing library or what programming
>> language this is to figure out that it matches three characters.
>
> Really? I would not have guessed that "one of sh" means "one of the
> characters in the string" vs "one instance of the string 'sh'"
OK. So it's not completely trivial. Easier than trying to guess what
"[s|h]" is meant to mean though. :-P
>> Of course, the only reason that anybody ever uses Perl is because it has
>> built-in regex support. This, together with low-level text munging, is
>> literally ALL PERL DOES! >_<
>
> It's a report generation language. It's right in the name.
Funny, I could have sworn I already /said/ that. ;-)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Am 19.07.2012 21:34, schrieb Orchid Win7 v1:
>>> oneOf "sh"
>>> char 'd'
>>> letter
>>>
>>> You don't even need to know which parsing library or what programming
>>> language this is to figure out that it matches three characters.
>>
>> Really? I would not have guessed that "one of sh" means "one of the
>> characters in the string" vs "one instance of the string 'sh'"
>
> OK. So it's not completely trivial. Easier than trying to guess what
> "[s|h]" is meant to mean though. :-P
Nonsense. First of all it's "(s|h)". Now, the parentheses should be no
problem to decipher for anyone familiar with the basics of mathematics:
There, it is used to override operator precedence by grouping parts of
the term into a sub-term. Same in RegExes; it should be pretty easy to
come to the presumption that "(s|h)" means "a group of characters that
matches 's|h'".
Now for the "|", this is quite a well established symbol for an "or"
operation in various languages (e.g. C, POV-Ray SDL, etc.). With this in
mind, it's a matter of seconds to realize that "s|h" might mean "'s' or
'h'".
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 2012-07-19 16:30, clipka wrote:
> Now for the "|", this is quite a well established symbol for an "or"
> operation in various languages (e.g. C, POV-Ray SDL, etc.). With this in
> mind, it's a matter of seconds to realize that "s|h" might mean "'s' or
> 'h'".
And the "s|h" form is visually similar enough to the more-common
"and/or" that even if you didn't happen to know that | meant 'or', you'd
have a better-than-zero chance of guessing its intent.
(So what is the result of &/| anyways?)
--
Tim Cook
http://empyrean.sjcook.com
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Am 20.07.2012 00:04, schrieb Tim Cook:
> On 2012-07-19 16:30, clipka wrote:
>> Now for the "|", this is quite a well established symbol for an "or"
>> operation in various languages (e.g. C, POV-Ray SDL, etc.). With this in
>> mind, it's a matter of seconds to realize that "s|h" might mean "'s' or
>> 'h'".
>
> And the "s|h" form is visually similar enough to the more-common
> "and/or" that even if you didn't happen to know that | meant 'or', you'd
> have a better-than-zero chance of guessing its intent.
>
> (So what is the result of &/| anyways?)
Related question: 2b|!2b?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 07/19/2012 06:14 PM, clipka wrote:
> Related question: 2b|!2b?
LOL ... clever and thought provoking at the same time
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |