[nfbcs] Counting parentheses

Mike Freeman k7uij at panix.com
Mon Oct 26 18:40:05 UTC 2015


I've done the same thing.

Mike Freeman


-----Original Message-----
From: nfbcs [mailto:nfbcs-bounces at nfbnet.org] On Behalf Of Doug Lee via
nfbcs
Sent: Monday, October 26, 2015 10:55 AM
To: John G Heim via nfbcs
Cc: Doug Lee
Subject: Re: [nfbcs] Counting parentheses

Of course this only works while authoring code, not reading someone else's,
but...

My solution is to avoid counting them altogether: When I type an open paren,
I also type the closing one, then backspace once. I use the same trick for
loop and if/else terminations and such: Write the full pair, then fill in
the new hole.

On Mon, Oct 26, 2015 at 12:18:35PM -0500, NFBCS mailing list wrote:
Listen to the sql query a character at a time adding 1 to the count each
time you cursor over a left paren and subtracting one each time you cursor
over a right paren.  It's like how they count cards in Vegas.


The only problem with this method is that you might get to the end of the
query and discover that you are missing a parenthesis but it might not be
clear where. What I would do in this case is do it again, this time
listening for the point where I know I should subtract 1 instead of add. Or
just take a shot and put a right paren at the end which is almost always the
solution anyway.




On 10/26/2015 12:01 PM, Tracy Carcione via nfbcs wrote:
>I am having trouble keeping track of parentheses in complicated SQL 
>statements.  Perhaps when I know SQL better, it will be less confusing.
>Sometimes I have an abacus handy to keep track of counts, but not always.
>What methods do people use to make sure there is a ) for each (?
>Thanks.
>Tracy
>
>
>
>_______________________________________________
>nfbcs mailing list
>nfbcs at nfbnet.org
>http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
>To unsubscribe, change your list options or get your account info for
nfbcs:
>http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/jheim%40math.wisc.ed
>u
>

--
John Heim, jheim at math.wisc.edu, 608-263-4189, skype:john.g.heim,
sip:jheim at sip.linphone.org

_______________________________________________
nfbcs mailing list
nfbcs at nfbnet.org
http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
To unsubscribe, change your list options or get your account info for nfbcs:
http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/dgl%40dlee.org

-- 
Doug Lee                 dgl at dlee.org                http://www.dlee.org
SSB BART Group           doug.lee at ssbbartgroup.com
http://www.ssbbartgroup.com
"The U. S. Constitution doesn't guarantee happiness, only the pursuit of it.
You have to catch up with it yourself." --Benjamin Franklin

_______________________________________________
nfbcs mailing list
nfbcs at nfbnet.org
http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
To unsubscribe, change your list options or get your account info for nfbcs:
http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/k7uij%40panix.com





More information about the NFBCS mailing list