TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How is the avg in my HN profile calculated?

15 点作者 vijaydev超过 14 年前
I currently have a karma of 1556 and an average of 2.55. I'm a HN'er for 509 days as on date. Clearly, the average is not straight forward. So, how is it calculated?

4 条评论

zck超过 14 年前
I marked up the code pointed to by mrduncan with comments (a semicolon begins a comment in Arc).<p><pre><code> (def comment-score (user) (aif ;; (aif test true-part false-part) ;; if test is true, assign its value ;; to the variable it and evaluate ;; true-part. Otherwise, evaluate ;; false-part. ;; This could alternately be awhen, and leave out nil at the end ;; of this function (check (nthcdr 5 (comments user 50)) [len&#62; _ 10]) ;; if the user has at least 15 comments, assign ;; the comments numbered 6-50 to the variable it (avg ;; get the average of the list returned from the next line (cdr ;; take every score but the first (sort &#62; ;; order the scores, so the "first" score mentioned above is ;; the highest-scoring one (map !score (rem !deleted it))))) ;; get the scores of each comment ;; as a list nil)) </code></pre> So it takes your comments numbered 6-50, throws out the highest-scoring one, and averages them. This is assuming the code posted by mrduncan is still correct (I'm not digging through a fresh copy of the source right now).
mrduncan超过 14 年前
<p><pre><code> ; Ignore the most recent 5 comments since they may still be gaining votes. ; Also ignore the highest-scoring comment, since possibly a fluff outlier. </code></pre> <a href="http://github.com/nex3/arc/blob/master/news.arc#L2301" rel="nofollow">http://github.com/nex3/arc/blob/master/news.arc#L2301</a><p>It may be slightly different now, but probably not by much.
10ren超过 14 年前
I've heard it described as basically the aveage of recent comments, with the highest and lowest outliers thrown out. (I guess the formula's in the source if you really want to know).
jogle超过 14 年前
total karma / # comments = average?