Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Created April 28, 2011 14:59
Show Gist options
  • Select an option

  • Save jashkenas/946506 to your computer and use it in GitHub Desktop.

Select an option

Save jashkenas/946506 to your computer and use it in GitHub Desktop.
(= gravity* 1.8 timebase* 120 front-threshold* 1
nourl-factor* .4 lightweight-factor* .3 )
(def frontpage-rank (s (o scorefn realscore) (o gravity gravity*))
(* (/ (let base (- (scorefn s) 1)
(if (> base 0) (expt base .8) base))
(expt (/ (+ (item-age s) timebase*) 60) gravity))
(if (no (in s!type 'story 'poll)) .5
(blank s!url) nourl-factor*
(lightweight s) (min lightweight-factor*
(contro-factor s))
(contro-factor s))))
(def contro-factor (s)
(aif (check (visible-family nil s) [> _ 20])
(min 1 (expt (/ (realscore s) it) 2))
1))
(def realscore (i) (- i!score i!sockvotes))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment