Gnus development mailing list
 help / color / mirror / Atom feed
* Using gnus-summary-number-of-articles-in-thread
@ 1995-12-19 16:34 Sten Drescher
  1995-12-19 17:21 ` Per Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Sten Drescher @ 1995-12-19 16:34 UTC (permalink / raw)


	I'm attempting to create the function
gnus-thread-sort-by-average-score (to deal with those threads that
rocket to the top of the total-score sort because the couple of articles
I read ballooned into a monster thread of 50 kazillon postings) as follows:

(defun gnus-thread-sort-by-average-score (h1 h2)
  "Sort threads by the average of all scores in the thread.
Unscored articles will be counted as having a score of zero."
  (>
   ( / (gnus-thread-total-score h1)
       (gnus-summary-number-of-articles-in-thread h1))
   ( / (gnus-thread-total-score h2)
       (gnus-summary-number-of-articles-in-thread h2))))

	Problem is, while gnus-thread-total-score returns the score,
gnus-summary-number-of-articles-in-thread is returning zero!  What am I
doing wrong here?

-- 
#include <disclaimer.h>				/* Sten Drescher */
To get my PGP public key, send me email with your public key and
	Subject: PGP key exchange
Key fingerprint =  90 5F 1D FD A6 7C 84 5E  A9 D3 90 16 B2 44 C4 F3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using gnus-summary-number-of-articles-in-thread
  1995-12-19 16:34 Using gnus-summary-number-of-articles-in-thread Sten Drescher
@ 1995-12-19 17:21 ` Per Abrahamsen
  1995-12-19 19:13   ` Sten Drescher
  0 siblings, 1 reply; 3+ messages in thread
From: Per Abrahamsen @ 1995-12-19 17:21 UTC (permalink / raw)
  Cc: ding


You could also use

	gnus-thread-sort-by-total-score

and then set 

	gnus-thread-score-function

to some function taking the average.

E.g:

(defun arithmetic-average (&rest numbers)
  (/ (apply '+ numbers) (length numbers)))

(setq gnus-thread-score-function 'arithmetic-average)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using gnus-summary-number-of-articles-in-thread
  1995-12-19 17:21 ` Per Abrahamsen
@ 1995-12-19 19:13   ` Sten Drescher
  0 siblings, 0 replies; 3+ messages in thread
From: Sten Drescher @ 1995-12-19 19:13 UTC (permalink / raw)


Per Abrahamsen <abraham@dina.kvl.dk> said:

PA> You could also use

PA> 	gnus-thread-sort-by-total-score

PA> and then set

PA> 	gnus-thread-score-function

PA> to some function taking the average.

E.g>

PA> (defun arithmetic-average (&rest numbers)
PA>   (/ (apply '+ numbers) (length numbers)))

PA> (setq gnus-thread-score-function 'arithmetic-average)

	That won't work, because arithmetic-average won't get passed the
entire list of scores, but the score of the parent and its sub-threads:

---
gnus-thread-score-function's value is +

Documentation:
*Function used for calculating the total score of a thread.

The function is called with the scores of the article and each
subthread and should then return the score of the thread.
---

	This means that if there is a subthread of 20 articles averaging
5 (total 100), a subthread of 2 articles averaging 50 (100), and a
parent of 100, arithmetic-average would return 32 instead of 13.

-- 
#include <disclaimer.h>				/* Sten Drescher */
To get my PGP public key, send me email with your public key and
	Subject: PGP key exchange
Key fingerprint =  90 5F 1D FD A6 7C 84 5E  A9 D3 90 16 B2 44 C4 F3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-12-19 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-12-19 16:34 Using gnus-summary-number-of-articles-in-thread Sten Drescher
1995-12-19 17:21 ` Per Abrahamsen
1995-12-19 19:13   ` Sten Drescher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).