On Thu, 21 Jul 2011 05:58:48 -0700 (PDT)
Xah Lee wrote:
[...]
> > > On Sunday, July 17, 2011 2:48:42 AM UTC-7, Raymond Hettinger wrote:
> > >> On Jul 17, 12:47 am, Xah Lee wrote:
> > >>> i hope you'll participate. Just post solution here. Thanks.
> >
> > >>http://pastebin.com/7hU20NNL
> >
> > >
On 7/21/2011 2:53 PM, Xah Lee wrote:
had hopes that parser expert would show some proper parser solutions…
in particular i think such can be expressed in Parsing Expression
Grammar in just a few lines… but so far no deity came forward to show
the light. lol
I am not a parser expert but 20 year
On 07/21/2011 09:23 AM, Xah Lee wrote:
Thanks for the code.
are you willing to make it complete and standalone? i.e. i can run it
like this:
perl Rouslan_Korneychuk.pl dirPath
and it prints any file that has mismatched pair and line/column number
or the char position?
Since you asked, I put
On Jul 21, 9:43 am, pyt...@bdurham.com wrote:
> Xah,
>
> 1. Is the following string considered legal?
>
> [ { ( ] ) }
>
> Note: Each type of brace opens and closes in the proper sequence. But
> inter-brace opening and closing does not make sense.
nu!
> Or must a closing brace always balance out
Xah,
1. Is the following string considered legal?
[ { ( ] ) }
Note: Each type of brace opens and closes in the proper sequence. But
inter-brace opening and closing does not make sense.
Or must a closing brace always balance out with the most recent opening
brace like so?
[ { ( ) } ]
2. If the
Ok. Here's a preliminary report.
〈Lisp, Python, Perl, Ruby … Code to Validate Matching Brackets〉
http://xahlee.org/comp/validate_matching_brackets.html
it's taking too much time to go thru.
right now, i consider only one valid code, by Raymond Hettinger (with
minor edit from others).
right now,
On Thu, Jul 21, 2011 at 6:58 AM, Xah Lee wrote:
> Thanks a lot for the fix Raymond.
That fix was from Thomas Jollans, not Raymond Hettinger.
> Though, the code seems to have a minor problem.
> It works, but the report is wrong.
> e.g. output:
>
> 30068: c:/Users/h3/web/xahlee_org/p/time_machine\
2011-07-21
On Jul 18, 12:09 am, Rouslan Korneychuk wrote:
> I don't know why, but I just had to try it (even though I don't usually
> use Perl and had to look up a lot of stuff). I came up with this:
>
> /(?|
> (\()(?&matched)([\}\]”›»】〉》」』]|$) |
> (\{)(?&matched)([\)\]”›»】〉》」』]|$) |
>
On 21/07/11 14:29, Xah Lee wrote:
> On Jul 19, 11:14 am, Thomas Jollans wrote:
>> I thought I'd have some fun with multi-processing:
>
> Nice joke. ☺
>
>> Here's a sane version:
>>
>> https://gist.github.com/1087682/2240a0834463d490c29ed0f794ad15128849ff8e
>
> hi thomas,
>
> i still cant get y
On Jul 19, 11:07 am, Thomas Jollans wrote:
> On 19/07/11 18:54, Xah Lee wrote:
>
>
>
>
>
>
>
>
>
> > On Sunday, July 17, 2011 2:48:42 AM UTC-7, Raymond Hettinger wrote:
> >> On Jul 17, 12:47 am, Xah Lee wrote:
> >>> i hope you'll participate. Just post solution here. Thanks.
>
> >>http://pastebin
On Jul 19, 11:14 am, Thomas Jollans wrote:
> I thought I'd have some fun with multi-processing:
Nice joke. ☺
> Here's a sane version:
>
> https://gist.github.com/1087682/2240a0834463d490c29ed0f794ad15128849ff8e
hi thomas,
i still cant get your code to work. I have a dir named xxdir with a
sing
On Wed, Jul 20 2011, Randal L. Schwartz wrote:
>> "Uri" == Uri Guttman writes:
>
> Uri> a better parsing challenge. how can you parse usenet to keep this troll
> Uri> from posting on the wrong groups on usenet? first one to do so, wins the
> Uri> praise of his peers. 2nd one to do it makes su
> "Uri" == Uri Guttman writes:
Uri> a better parsing challenge. how can you parse usenet to keep this troll
Uri> from posting on the wrong groups on usenet? first one to do so, wins the
Uri> praise of his peers. 2nd one to do it makes sure the filter stays in
Uri> place. all the rest will be
On Jul 20, 9:31 pm, "Uri Guttman" wrote:
> a better parsing challenge. how can you parse usenet to keep this troll
> from posting on the wrong groups on usenet? first one to do so, wins the
> praise of his peers. 2nd one to do it makes sure the filter stays in
> place. all the rest will be rewarde
a better parsing challenge. how can you parse usenet to keep this troll
from posting on the wrong groups on usenet? first one to do so, wins the
praise of his peers. 2nd one to do it makes sure the filter stays in
place. all the rest will be rewarded by not seeing the troll anymore.
anyone who ac
i've just cleaned up my elisp code and wrote a short elisp tutorial.
Here:
〈Emacs Lisp: Batch Script to Validate Matching Brackets〉
http://xahlee.org/emacs/elisp_validate_matching_brackets.html
plain text version follows. Please let me know what you think.
am still working on going thru all cod
On Wed, 20 Jul 2011 05:54 pm jmfauth wrote:
> DRY? acronym for ?
I'd like to tell you, but I already told somebody else...
*grins*
http://en.wikipedia.org/wiki/Don't_repeat_yourself
http://c2.com/cgi/wiki?DontRepeatYourself
--
Steven
--
http://mail.python.org/mailman/listinfo/python-l
On 20 juil, 09:29, Ian Kelly wrote:
> Otherwise, here's another non-DRY solution:
>
> >>> from itertools import izip
> >>> for i, c in izip(reversed(xrange(len(s))), reversed(s)):
>
> ...
>
> Unfortunately, this is one space where there just doesn't seem to be a
> single obvious way to do it.
We
On Wed, Jul 20, 2011 at 12:29 AM, jmfauth wrote:
>> Then it is hard to code precisely.
>>
>
> Not really. The trick is to count the different opener/closer
> separately.
> That is what I am doing to check balanced brackets in
> chemical formulas. The rules are howerver not the same
> as in math.
On Jul 17, 8:47 am, Xah Lee wrote:
> 2011-07-16
>
> folks, this one will be interesting one.
>
> the problem is to write a script that can check a dir of text files
> (and all subdirs) and reports if a file has any mismatched matching
> brackets.
>
> • The files will be utf-8 encoded (unix style l
On 19 juil, 21:09, Terry Reedy wrote:
> On 7/19/2011 2:12 PM, Xah Lee wrote:
>
> >> Also, you may have answered this earlier but I'll ask again anyways: You
> >> ask for the first mismatched pair, Are you referring to the inner most
> >> mismatched, or the outermost? For example, suppose you have
On 18.07.2011 16:39, Xah Lee wrote:
On Jul 17, 12:47 am, Xah Lee wrote:
2011-07-16
folks, this one will be interesting one.
the problem is to write a script that can check a dir of text files
(and all subdirs) and reports if a file has any mismatched matching
brackets.
…
Ok, here's my solu
On 7/19/2011 2:12 PM, Xah Lee wrote:
Also, you may have answered this earlier but I'll ask again anyways: You
ask for the first mismatched pair, Are you referring to the inner most
mismatched, or the outermost? For example, suppose you have this file:
foo[(])bar
Would the "(" be the first mis
Oh, by the way:
On 19/07/11 19:49, Xah Lee wrote:
> I ran the program, all cpu went max
Mission accomplished.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 19, 10:33 am, Billy Mays
<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote:
> On 07/19/2011 01:14 PM,XahLee wrote:
>
> > I added other unicode brackets to your list of brackets, but it seems
> > your code still fail to catch a file that has mismatched curly quotes.
> > (e.
On 19/07/11 19:49, Xah Lee wrote:
> On Jul 17, 8:31 am, Thomas Jollans wrote:
>>
>> I thought I'd have some fun with multi-processing:
>>
>> https://gist.github.com/1087682
>
> hi Thomas. I ran the program, all cpu went max (i have a quad), but
> after i think 3 minutes nothing happens, so i kill
On Tue, Jul 19, 2011 at 10:54 AM, Xah Lee wrote:
> On Sunday, July 17, 2011 2:48:42 AM UTC-7, Raymond Hettinger wrote:
>> On Jul 17, 12:47 am, Xah Lee wrote:
>> > i hope you'll participate. Just post solution here. Thanks.
>>
>> http://pastebin.com/7hU20NNL
>
> just installed py3.
> there seems t
On 19/07/11 18:54, Xah Lee wrote:
> On Sunday, July 17, 2011 2:48:42 AM UTC-7, Raymond Hettinger wrote:
>> On Jul 17, 12:47 am, Xah Lee wrote:
>>> i hope you'll participate. Just post solution here. Thanks.
>>
>> http://pastebin.com/7hU20NNL
>
> just installed py3.
> there seems to be a bug.
> in
On Jul 17, 8:31 am, Thomas Jollans wrote:
> On Jul 17, 9:47 am,XahLee wrote:
>
>
>
>
>
>
>
>
>
> > 2011-07-16
>
> > folks, this one will be interesting one.
>
> > the problem is to write a script that can check a dir of text files
> > (and all subdirs) and reports if a file has any mismatched mat
On 07/19/2011 01:14 PM, Xah Lee wrote:
I added other unicode brackets to your list of brackets, but it seems
your code still fail to catch a file that has mismatched curly quotes.
(e.g.http://xahlee.org/p/time_machine/tm-ch04.html )
LOL Billy.
Xah
I suspect its due to the file mode being o
On Jul 18, 2:59 pm, Thomas 'PointedEars' Lahn
wrote:
> Ian Kelly wrote:
> > Billy Mays wrote:
> >> I gave it a shot. It doesn't do any of the Unicode delims, because let's
> >> face it, Unicode is for goobers.
>
> > Uh, okay...
>
> > Your script also misses the requirement of outputting the inde
On Jul 18, 10:12 am, Billy Mays
<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote:
> On 07/17/2011 03:47 AM,XahLee wrote:
>
> > 2011-07-16
>
> I gave it a shot. It doesn't do any of the Unicode delims, because
> let's face it, Unicode is for goobers.
>
> import sys, os
>
> pair
On Sunday, July 17, 2011 2:48:42 AM UTC-7, Raymond Hettinger wrote:
> On Jul 17, 12:47 am, Xah Lee wrote:
> > i hope you'll participate. Just post solution here. Thanks.
>
> http://pastebin.com/7hU20NNL
just installed py3.
there seems to be a bug.
in this file
http://xahlee.org/p/time_machine/tm
On Jul 18, 7:07 pm, Billy Mays wrote:
> On 7/18/2011 7:56 PM, Steven D'Aprano wrote:
>
>
>
>
>
>
>
>
>
> > Billy Mays wrote:
>
> >> On 07/17/2011 03:47 AM, Xah Lee wrote:
> >>> 2011-07-16
>
> >> I gave it a shot. It doesn't do any of the Unicode delims, because
> >> let's face it, Unicode is for
Thomas 'PointedEars' Lahn wrote:
> with open(os.path.join(dirpath, name), 'r') as f:
SHOULD be
with open(os.path.join(dirpath, name), 'rb') as f:
(as in the original), else the some code units might not be read properly.
--
PointedEars
Bitte keine Kopien per E-Mail. /
On Tue, Jul 19, 2011 at 2:59 PM, rusi wrote:
> Some evidences of leakiness:
> code point vs character vs byte
> encoding and decoding
> UTF-x and UCS-y
>
> Very important and necessary distinctions? Maybe... But I did not need
> them when my world was built of the 127 bricks of ASCII.
Codepoint v
On Jul 19, 8:11 am, Steven D'Aprano wrote:
> rusi wrote:
> > Every time I try to understand unicode and remain stuck I come to the
> > conclusion that I must be an imbecile.
>
> http://www.joelonsoftware.com/articles/Unicode.html
>
> --
> Steven
Yes Ive read that and understood a little bit more
Billy Mays wrote:
> TL;DR version: international character sets are a problem, and Unicode
> is not the answer to that problem).
Shorter version: FUD.
Yes, having a rich and varied character set requires work. Yes, the Unicode
standard itself, and any interface to it (including Python's) are imp
On Mon, Jul 18, 2011 at 7:07 PM, Billy Mays wrote:
>
> On 7/18/2011 7:56 PM, Steven D'Aprano wrote:
>>
>> Billy Mays wrote:
>>
>>> On 07/17/2011 03:47 AM, Xah Lee wrote:
2011-07-16
>>>
>>> I gave it a shot. It doesn't do any of the Unicode delims, because
>>> let's face it, Unicode is f
rusi wrote:
> Every time I try to understand unicode and remain stuck I come to the
> conclusion that I must be an imbecile.
http://www.joelonsoftware.com/articles/Unicode.html
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 19/07/2011 03:07, Billy Mays wrote:
On 7/18/2011 7:56 PM, Steven D'Aprano wrote:
Billy Mays wrote:
On 07/17/2011 03:47 AM, Xah Lee wrote:
2011-07-16
I gave it a shot. It doesn't do any of the Unicode delims, because
let's face it, Unicode is for goobers.
Goobers... that would be one of
On Jul 19, 7:07 am, Billy Mays wrote:
> On 7/18/2011 7:56 PM, Steven D'Aprano wrote:
>
>
>
> > Billy Mays wrote:
>
> >> On 07/17/2011 03:47 AM, Xah Lee wrote:
> >>> 2011-07-16
>
> >> I gave it a shot. It doesn't do any of the Unicode delims, because
> >> let's face it, Unicode is for goobers.
>
>
On 7/18/2011 7:56 PM, Steven D'Aprano wrote:
Billy Mays wrote:
On 07/17/2011 03:47 AM, Xah Lee wrote:
2011-07-16
I gave it a shot. It doesn't do any of the Unicode delims, because
let's face it, Unicode is for goobers.
Goobers... that would be one of those new-fangled slang terms that the
Billy Mays wrote:
> On 07/17/2011 03:47 AM, Xah Lee wrote:
>> 2011-07-16
>
> I gave it a shot. It doesn't do any of the Unicode delims, because
> let's face it, Unicode is for goobers.
Goobers... that would be one of those new-fangled slang terms that the young
kids today use to mean its opposi
Ian Kelly wrote:
> Billy Mays wrote:
>> I gave it a shot. It doesn't do any of the Unicode delims, because let's
>> face it, Unicode is for goobers.
>
> Uh, okay...
>
> Your script also misses the requirement of outputting the index or row
> and column of the first mismatched bracket.
Thanks t
On 07/18/2011 12:46 PM, Thomas 'PointedEars' Lahn wrote:
Rouslan Korneychuk wrote:
I don't know why, but I just had to try it (even though I don't usually
use Perl and had to look up a lot of stuff). I came up with this:
I don't know why … you replied to my posting/e-mail (but quoted nothing
On Mon, Jul 18, 2011 at 11:12 AM, Billy Mays
<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote:
> I gave it a shot. It doesn't do any of the Unicode delims, because let's
> face it, Unicode is for goobers.
Uh, okay...
Your script also misses the requirement of outputting the i
On 07/17/2011 03:47 AM, Xah Lee wrote:
2011-07-16
I gave it a shot. It doesn't do any of the Unicode delims, because
let's face it, Unicode is for goobers.
import sys, os
pairs = {'}':'{', ')':'(', ']':'[', '"':'"', "'":"'", '>':'<'}
valid = set( v for pair in pairs.items() for v in pair
Rouslan Korneychuk wrote:
> I don't know why, but I just had to try it (even though I don't usually
> use Perl and had to look up a lot of stuff). I came up with this:
I don't know why … you replied to my posting/e-mail (but quoted nothing from
it, much less referred to its content), and posted
On Jul 17, 12:47 am, Xah Lee wrote:
> 2011-07-16
>
> folks, this one will be interesting one.
>
> the problem is to write a script that can check a dir of text files
> (and all subdirs) and reports if a file has any mismatched matching
> brackets.
> …
Ok, here's my solution (pasted at bottom). I
On 07/18/2011 03:24 AM, Stefan Behnel wrote:
That's solid Perl. Both the code generator and the generated code are
unreadable. Well done!
Stefan
Why, thank you.
--
http://mail.python.org/mailman/listinfo/python-list
Rouslan Korneychuk, 18.07.2011 09:09:
I don't know why, but I just had to try it (even though I don't usually use
Perl and had to look up a lot of stuff). I came up with this:
/(?|
(\()(?&matched)([\}\]”›»】〉》」』]|$) |
(\{)(?&matched)([\)\]”›»】〉》」』]|$) |
(\[)(?&matched)([\)\}”›»】〉》」』]|$) |
(“)(?&m
I don't know why, but I just had to try it (even though I don't usually
use Perl and had to look up a lot of stuff). I came up with this:
/(?|
(\()(?&matched)([\}\]”›»】〉》」』]|$) |
(\{)(?&matched)([\)\]”›»】〉》」』]|$) |
(\[)(?&matched)([\)\}”›»】〉》」』]|$) |
(“)(?&matched)([\)\}\]›»】〉》」』
On Jul 17, 2:47 am, Xah Lee wrote:
> 2011-07-16
>
> folks, this one will be interesting one.
>
> the problem is to write a script that can check a dir of text files
> (and all subdirs) and reports if a file has any mismatched matching
> brackets.
>
>[...]
>
> • You script must be standalone. Must
Thomas 'PointedEars' Lahn wrote:
> It is possible [to parse the parentheses language], with Perl-compatible
> Regular Expressions (PCRE), provided that you have enough memory, to use
> such an extended Regular Expression (not to be confused with EREs³)⁴:
>
> \((([^()]*|(?R))*)\)
>
> However, e
On 07/17/2011 10:16 PM, Thomas 'PointedEars' Lahn wrote:
> Raymond Hettinger wrote:
>
>> Thomas 'PointedEars' Lahn wrote:
>>> Did you notice the excessive crosspost? Please do not feed the troll.
>>
>> IMO, this was a legitimate cross post since it is for a multi-language
>> programming challenge
Raymond Hettinger wrote:
> Thomas 'PointedEars' Lahn wrote:
>> Did you notice the excessive crosspost? Please do not feed the troll.
>
> IMO, this was a legitimate cross post since it is for a multi-language
> programming challenge and everyone can learn from comparing the
> results.
Even if so
On Jul 17, 8:49 am, Thomas Boell wrote:
> But why do you enumerate with start=1? Shouldn't you start with index 0?
The problem specification says that the the char number should match
the emacs goto-char function which is indexed from one, not from
zero. This is testable by taking the output of
On Jul 17, 7:15 am, Thomas 'PointedEars' Lahn
wrote:
> Did you notice the excessive crosspost? Please do not feed the troll.
IMO, this was a legitimate cross post since it is for a multi-language
programming challenge and everyone can learn from comparing the
results.
Raymond
--
http://mail.p
On 07/17/2011 06:01 PM, Robert Klemme wrote:
On 07/17/2011 03:55 PM, mhenn wrote:
Am 17.07.2011 15:20, schrieb Robert Klemme:
On 07/17/2011 11:48 AM, Raymond Hettinger wrote:
On Jul 17, 12:47 am, Xah Lee wrote:
i hope you'll participate. Just post solution here. Thanks.
http://pastebin.com/
On 07/17/2011 03:55 PM, mhenn wrote:
Am 17.07.2011 15:20, schrieb Robert Klemme:
On 07/17/2011 11:48 AM, Raymond Hettinger wrote:
On Jul 17, 12:47 am, Xah Lee wrote:
i hope you'll participate. Just post solution here. Thanks.
http://pastebin.com/7hU20NNL
Ruby solution: https://gist.githu
On Sun, 17 Jul 2011 02:48:42 -0700 (PDT)
Raymond Hettinger wrote:
> On Jul 17, 12:47 am, Xah Lee wrote:
> > i hope you'll participate. Just post solution here. Thanks.
>
> http://pastebin.com/7hU20NNL
I'm new to Python. I think I'd have done it in a similar way (in any
language). Your use of o
On Jul 17, 9:47 am, Xah Lee wrote:
> 2011-07-16
>
> folks, this one will be interesting one.
>
> the problem is to write a script that can check a dir of text files
> (and all subdirs) and reports if a file has any mismatched matching
> brackets.
>
> • The files will be utf-8 encoded (unix style l
On Sunday, July 17, 2011 10:12:27 AM Xah Lee did opine:
> 2011-07-16
>
> folks, this one will be interesting one.
>
> the problem is to write a script that can check a dir of text files
> (and all subdirs) and reports if a file has any mismatched matching
> brackets.
>
> • The files will be utf
Chris Angelico wrote:
> On Sun, Jul 17, 2011 at 5:47 PM, Xah Lee wrote:
>> the problem is to write a script that can check a dir of text files
>> (and all subdirs) and reports if a file has any mismatched matching
>> brackets.
>
> I wonder will it be possible to code the whole thing as a single
Am 17.07.2011 15:20, schrieb Robert Klemme:
> On 07/17/2011 11:48 AM, Raymond Hettinger wrote:
>> On Jul 17, 12:47 am, Xah Lee wrote:
>>> i hope you'll participate. Just post solution here. Thanks.
>>
>> http://pastebin.com/7hU20NNL
>
> Ruby solution: https://gist.github.com/1087583
I acutally d
On 07/17/2011 11:48 AM, Raymond Hettinger wrote:
On Jul 17, 12:47 am, Xah Lee wrote:
i hope you'll participate. Just post solution here. Thanks.
http://pastebin.com/7hU20NNL
Ruby solution: https://gist.github.com/1087583
Kind regards
robert
--
http://mail.python.org/mailman/listinfo/pytho
On Jul 17, 4:34 pm, Chris Angelico wrote:
> On Sun, Jul 17, 2011 at 5:47 PM, Xah Lee wrote:
> > the problem is to write a script that can check a dir of text files
> > (and all subdirs) and reports if a file has any mismatched matching
> > brackets.
>
> I wonder will it be possible to code the wh
On Sun, Jul 17, 2011 at 5:47 PM, Xah Lee wrote:
> the problem is to write a script that can check a dir of text files
> (and all subdirs) and reports if a file has any mismatched matching
> brackets.
I wonder will it be possible to code the whole thing as a single
regular expression... I'm pretty
On Jul 17, 12:47 am, Xah Lee wrote:
> i hope you'll participate. Just post solution here. Thanks.
http://pastebin.com/7hU20NNL
Raymond
--
http://mail.python.org/mailman/listinfo/python-list
70 matches
Mail list logo