Named it columnupdate_kobocoll.
All three of the listed columns are taglikes; #genres and #vls are composites (former puiling from tags, latter using the virtual_libraries() function).
Code:
program:
g = field('#genres');
k = field('#kobocoll');
vl = field('#vls');
v = first_non_empty(
list_contains(vl, ',', '^Loans$', 'Loans', ''),
list_contains(g, ',', '^Fanfiction$', 'Fanfiction', ''),
list_contains(g, ',', '^Horses$', 'Horses', ''),
list_contains(g, ',', '^Cozy Mystery$', 'Cozy Mysteries', ''),
list_contains(g, ',', '^(Fantasy|Science Fiction)$', 'Fantasy & Sci-Fi', ''),
);
list_union(k, v, ',')
If it matters, I'm trying to update #kobocoll itself without erasing existing values.