

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

Sure, you <i>could</i> 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.<p>Behold!  The three-line recipe that will enlighten you in several ways:<p><pre><code>  wget http://ycombinator.com/arc/arc3.1.tar
  tar xf arc3.1.tar
  grep -n -E "\(= [^-]+-threshold" arc3.1/news.arc
</code></pre>
As of 2009/09/30:<p>1) topcolor threshold is 250<p>2) downvote threshold is 200<p>3) flag threshold is 30<p>As an exercise for the reader, figure out what the comment and poll thresholds are.<p>Bonus points: what is the mysterious leader threshold?
======
idm
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.

~~~
mahmud
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?]

~~~
idm
Yeah, but arc nevertheless is a Lisp, and for whatever reason, news.arc is
certainly using '=' to perform assignment.

------
vulpes
Tip: if you don't have wget installed on your fresh Mac, run curl -O instead.

~~~
idm
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.

------
jacquesm
The arc release is not 1:1 with the arc running HN.

~~~
idm
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?

~~~
jacquesm
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>

~~~
idm
Thanks for the reference! I suppose he _could_ release news.arc as a separate
file a little more frequently than the arc codebase.

------
idm
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.

------
whimsy
Downvote and flag make sense to me, but (pardon me if this is defined
elsewhere) what's this "topcolor" thing?

~~~
idm
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.

------
carbocation
You karma whore! (That said, consider yourself modded up.)

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

~~~
idm
:) 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.

