Tell HN: How to find karma thresholds in the HN source code

35 points by idm ↗ HN
Sure, you could ask pg to tell you what the karma thresholds are, but the fact of the matter is he's already told you -- it's just embedded in a sparsely commented, 2600-line file that is only distributed as part of the ARC language package.

Behold! The three-line recipe that will enlighten you in several ways:

  wget http://ycombinator.com/arc/arc3.1.tar
  tar xf arc3.1.tar
  grep -n -E "\(= [^-]+-threshold" arc3.1/news.arc
As of 2009/09/30:

1) topcolor threshold is 250

2) downvote threshold is 200

3) flag threshold is 30

As an exercise for the reader, figure out what the comment and poll thresholds are.

Bonus points: what is the mysterious leader threshold?

15 comments

[ 2.4 ms ] story [ 26.3 ms ] thread
I might as well point out that grep -n will give you line numbers in the output, so you can quickly reference the source code to figure out a little more from the context.

You could use grep -C3 to get some context right on the command line, but the output is a little cluttered for my taste.

The arc release is not 1:1 with the arc running HN.
Good point. With the recent experiment involving hidden comment scores, I understand pg was updating the code in the REPL.

...but if you want to grab the source code, is there any other way to get it, aside from the version that is bundled with arc?

No, PG explicitly said that there is some stuff in HN that will not be released, here is the reference:

http://news.ycombinator.com/item?id=830838

Thanks for the reference! I suppose he could release news.arc as a separate file a little more frequently than the arc codebase.
Tip: if you don't have wget installed on your fresh Mac, run curl -O instead.
Yeah - note that vulpes typed "dash oh" instead of "dash zero." The latter will send an HTTP 1.0 request (since curl defaults to HTTP 1.1) whereas the former will Output the file to disk (otherwise curl defaults to stdout).

...or just cut-and-paste, since vulpes typed it correctly.

Downvote and flag make sense to me, but (pardon me if this is defined elsewhere) what's this "topcolor" thing?
Topcolor is the hex code of the bar across the top of HN.

Check this out:

http://news.ycombinator.com/topcolors

It's a neat little page that displays a bunch of colors and hexcodes from live users' profiles.

(comment deleted)
I realize I should also point out what the regexp is doing, since it's pretty simple and it's the meat of the recipe.

It starts off by looking for the open paren that is the beginning of any LISP expression.

Next, it looks for an assignment statement. LISPs use prefix notation, so the function comes before the arguments. Contrast with infix syntax, which would put the assignment operator between its arguments (i.e. = a 2 versus a = 2).

Last, it looks for a string of characters that are followed by -threshold, which is the naming convention used by pg for variables that store threshold data.

Never has a Lisp used = for assignment. It's always a variant of "set".

Here is a page with various call-graphs for new.arc along with visualization tools:

http://arclanguage.org/item?id=8876

[Edit: Whoever downvoting me, could you please contribute a pointer to a Lisp that uses '=' as assignment other than Arc?]

Yeah, but arc nevertheless is a Lisp, and for whatever reason, news.arc is certainly using '=' to perform assignment.
You karma whore! (That said, consider yourself modded up.)

Also, please accept my apologies for writing as if I were on Slashdot.

:) Well, I noticed the issue of karma comes up more than once per year, and the thresholds are mysteriously different each time. I was about to ask (since I was certain I had read the downvote threshold was 100) when I realized I could just check the code. It turned out to be surprisingly hard to find the code, so I figured there must be some others in the HN community who will enjoy this quick demo.