News for hackers. Stuff that matters.
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by pg on Monday May 11, 2009 @05:30PM (#604366)

    > (with (topi nil topscore 0) 
        (each-loaded-item i 
          (when (and (astory i) (> (realscore i) topscore))
            (= topi i topscore (realscore i)))) 
        (list topi!id topscore)) 
    (459289 521)
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by SwellJoe on Monday May 11, 2009 @05:51PM (#604404)
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by ivankirigin on Tuesday May 12, 2009 @08:47AM (#605272)
In django, this might look something like this:

  s = Stories.objects.order_by('-num_votes')[0]
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by pg on Tuesday May 12, 2009 @12:42PM (#605678)
The query I did was much more complicated. The Arc equivalent of yours is

    ((sort (compare > score) stories*) 0)
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by ivankirigin on Tuesday May 12, 2009 @02:00PM (#605855)
Just in case it isn't clear, that order_by actually digs into the database layer to do the sorting there. It's a query that returns an iterator that gives you stories in that order one at a time.

To sort an existing list, over a particular member, it would be

  Stories.sort( key = lambda x: x.score )
That lambda has certainly confused a lot of people I know. Probably because they used the word "lambda" and not "function".
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by ckopec on Monday May 11, 2009 @05:13PM (#604338)
Under the lists section of HN there is a best category with the top submissions.

http://news.ycombinator.com/best

Re:Ask PG: What's The Most Points One Submission Has Ever Re... by raquo on Monday May 11, 2009 @05:26PM (#604353)
It counts only recent submissions as far as I can tell though
Re:Ask PG: What's The Most Points One Submission Has Ever Re... by gaika on Monday May 11, 2009 @09:48PM (#604705)