View Single Post
Old 04-03-2016, 11:30 PM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
iienderii: The pseudo code that I saw when I read this looks like:

Code:
primary_tags = ('a', 'b', 'c')
secondary_tags = ('d', 'e', 'f')

if column_x.contains_any_of(primary_tags):
   return "Primary"
else if column_x.contains_any_of(secondary_tags):
   return "Secondary"

return "Other"
Does that describe what you want? It doesn't quite match what you said, but I can't think of a use for the alternatives.

If I'm right, that "contains_any_of" should be able to be done with a "list_intersection" and a "count". I can't experiment at the moment, but if no-one else has suggested a way, I'll have a look when I get home.
davidfor is offline   Reply With Quote