Martin Fowler published a (rather long) blog post on the topic of refactoring code into data, which I think is a nice addition in this thread even though you already have a working solution:
http://martinfowler.com/articles/refactoring-adaptive-model.html His solution to this problem would have been to build a data model for the logic, and then a custom logic engine which can understand and make decisions based on the provided data. Perhaps overkill for this use case, but it's an interesting approach, IMO. // T On Tuesday, December 1, 2015 at 1:22:51 PM UTC+1, NotSoRecentConvert wrote: > > It worked quite well. Here is the latest version. > > function qcl_valve_plot(Dr::AbstractString,mindate::DateTime,maxdate:: > DateTime,dt::Dates.Period,col::Symbol,valveLogic::Function) > > ... > > # Valve Zones > f4 = [] > f4 = find(valveLogic(statuses) .== true) > > One of the valveLogic examples, "(V3 & !(V1 & V2)) == true", would now be > x -> x.Valve3 & !(x.Valve1 & x.Valve2). > > Thanks for the tip. >