View Single Post
Old 02-23-2021, 04:18 AM   #361
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
@capink: specifying a separator in a for statement and the function list_remove_duplicates(l, sep) are now available in master source.
Thanks for both. I don't seem to know how to use the new for loop. I am trying to modify your previous template to this:

Code:
program:
	all_authors = category_items('authors');
	res = '';
	for a in '&' all_authors:
		ratings = from_search('rating', strcat('rating:true and author"=', a, '"'));
		if ratings then
			avg = divide(mean(ratings), 2);
			res = list_union(res, strcat(a, ':', avg), ',')
		fi
	rof;
	res
Obviously I am doing something wrong (and probably silly) here.

Last edited by capink; 02-23-2021 at 04:24 AM.
capink is offline   Reply With Quote