5 ms·
Tell HN: How to find karma thresholds in the HN source code
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?
- idm 17y agoI 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.
- jacquesm 17y agoThe arc release is not 1:1 with the arc running HN.
- idm 17y agoGood 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?
- jacquesm 17y agoNo, 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 http://news.ycombinator.com/item?id=830838
- idm 17y agoThanks for the reference! I suppose he could release news.arc as a separate file a little more frequently than the arc codebase.
- vulpes 17y agoTip: if you don't have wget installed on your fresh Mac, run curl -O instead.
- idm 17y agoYeah - 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.
- whimsy 17y agoDownvote and flag make sense to me, but (pardon me if this is defined elsewhere) what's this "topcolor" thing?
- idm 17y agoTopcolor is the hex code of the bar across the top of HN. Check this out: http://news.ycombinator.com/topcolors http://news.ycombinator.com/topcolors It's a neat little page that displays a bunch of colors and hexcodes from live users' profiles.
- deleted 17y ago[deleted]
- idm 17y agoI 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.
- mahmud 17y agoNever 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 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?]
- idm 17y agoYeah, but arc nevertheless is a Lisp, and for whatever reason, news.arc is certainly using '=' to perform assignment.
- carbocation 17y agoYou karma whore! (That said, consider yourself modded up.) Also, please accept my apologies for writing as if I were on Slashdot.
- idm 17y ago:) 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.