HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
stochastic-thread
balanced_parentheses
Jupyter Notebook2019–2019
stochastic-thread / balanced_parentheses

balanced_parentheses

for HN

2Distinct people
2Mentions
0Explicit recommenders
0GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

for HN

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by hour2 dated mentions

Observed mentions: 2019-02-23 07:09:33 UTC to 2019-02-23 13:57:23 UTC.

012019-02-23 07:00:00 UTC to 2019-02-23 08:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsFeb 23, 07:002019-02-23 08:00:00 UTC to 2019-02-23 09:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-02-23 09:00:00 UTC to 2019-02-23 10:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-02-23 10:00:00 UTC to 2019-02-23 11:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsFeb 23, 10:002019-02-23 11:00:00 UTC to 2019-02-23 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-02-23 12:00:00 UTC to 2019-02-23 13:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-02-23 13:00:00 UTC to 2019-02-23 14:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsFeb 23, 13:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Feb 23, 07:002019-02-23 07:00:00 UTC2019-02-23 08:00:00 UTC101
Feb 23, 08:002019-02-23 08:00:00 UTC2019-02-23 09:00:00 UTC000
Feb 23, 09:002019-02-23 09:00:00 UTC2019-02-23 10:00:00 UTC000
Feb 23, 10:002019-02-23 10:00:00 UTC2019-02-23 11:00:00 UTC000
Feb 23, 11:002019-02-23 11:00:00 UTC2019-02-23 12:00:00 UTC000
Feb 23, 12:002019-02-23 12:00:00 UTC2019-02-23 13:00:00 UTC000
Feb 23, 13:002019-02-23 13:00:00 UTC2019-02-23 14:00:00 UTC101

What Hacker News says

2 sources
> https://github.com/stochastic-thread/balanced_parentheses/bl.... > What do you think of this implementation I just wrote? It is generalized to work with parentheses, brackets and braces, and to handle the different types of braces I just used different scores that offset each other depending on the direction of the symbol. Couldn't really think of a better way to handle this other than using numbers that don't add up to one another (in a momentary fugue state, I used 1,-1,2,-2,3,-3 as the score values but that obviously doesn't work as [}) would be false flagged as matched. Doesn't seem elegant to use random floats to accomplish this. Two critiques, one minor, and one major: Minor critique: is_balanced is a pure function. It doesn't need to be wrapped in a class, and an object doesn't need to be instantiated to call it. This adds comple
Read the rest
xity and in general is a bad habit. Languages like Java require classes, but that's Java exposing details of its underlying implementation, not a pattern to be imitated. Major critique: try your function with the string "((((((]]]]]". In general, your approach doesn't work, because for whatever numbers you use (such as x=1 and y=1.2) the scores will "collide" at when there are lcm(x,y) where lcm is the least common multiple function. There's an even subtler bug for the string "{)(}". > It's a pretty trivial problem, but I think coming up with a clever solution to the generalization is a little more interesting. Yes, once you're generalizing I think the PDA becomes basically the simplest solution. > P.S. your site is down Thanks! It actually wasn't down, my HN profile was just linking to an old URL. I fixed it. :)
In A Brutal Look at Balanced Parentheses, Computing Machines, and Pushdown Automata
https://github.com/stochastic-thread/balanced_parentheses/bl... What do you think of this implementation I just wrote? It is generalized to work with parentheses, brackets and braces, and to handle the different types of braces I just used different scores that offset each other depending on the direction of the symbol. Couldn't really think of a better way to handle this other than using numbers that don't add up to one another (in a momentary fugue state, I used 1,-1,2,-2,3,-3 as the score values but that obviously doesn't work as [}) would be false flagged as matched. Doesn't seem elegant to use random floats to accomplish this. It's a pretty trivial problem, but I think coming up with a clever solution to the generalization is a little more interesting. P.S. your site is down
In A Brutal Look at Balanced Parentheses, Computing Machines, and Pushdown Automata

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.