View Single Post
Old 07-08-2025, 06:59 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
This is a more efficient version of the template, making use of the fact that the universe prefix doesn't change for a given book.
Code:
program:
	result = '';
	if $#chars then
# The universe name is a constant for each book. Compute it once for efficiency
		prefix = strcat(result, first_non_empty($#universe, $series, $title), '.');

# Loop through the characters adding the universe prefix to the character
# and adding a trailing comma
		for char in '#chars':
			result = strcat(result, prefix, char, ',')
		rof;

# Clean up the list, adding spaces and removing the trailing comma
		result = list_union(result, '', ',')
	fi;
	result

Last edited by chaley; 07-08-2025 at 07:39 AM. Reason: Fix mistake in template
chaley is offline   Reply With Quote