View Single Post
Old 01-03-2023, 04:55 PM   #3
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,499
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
If I understand right, here's one instance I may find it useful:

FanFicFare adds an additional 'crossover' tag to #fanficcat when there's multiple entries. For certain sets of entries, I don't want this.

Since this isn't easy to work around in the FFF settings, I use a template to take the column, sort the entries, compare the string, and then replace if it matches:

Code:
program:
	f = list_sort($#fanficcat,0,',');

	if contains(f, '^Crossover, Mass Effect Trilogy, Mass Effect: Andromeda$', '1', '')
	then 'Mass Effect Trilogy, Mass Effect: Andromeda' 

	elif contains(f, '^Crossover, Half-Life, Portal$', '1', '')	
	then 'Half-Life, Portal' 

	else $#fanficcat

	fi
But my current solution working fairly well, so it's not a big deal either way.
Interesting. You are using list_sort() and contains() to test (sort-of) that one list is a subset of another list.

Question: Assume existence of a function list_is_subset(s1, s2, sep) that returns true (a non-empty value) if all the items in s2 are in s1. In this case, would you expect this example of the function list_subset() function to return True?
Code:
program:
    fanficcat = 'AAA, Crossover, DDD, Mass Effect Trilogy, Mass Effect: Andromeda';
    list_is_subset(fanficcat, 'Crossover, Mass Effect Trilogy, Mass Effect: Andromeda', ',')
All of the items in the second parameter are in the first parameter, so the second parameter is in fact a subset of the first. The items 'AAA' and 'DDD' in the first list are not in the second list, which is ignored.
chaley is offline   Reply With Quote