Is it possible to specialize pattern tests for f
such that the three VerificationTests
(below) succeed? Additionally, is there a performance and tuning guide specifically for data science pipelines that process large sets of Association
? For example, is it possible to Compile functions whose arguments include Association
?
f[assoc_ : Asssociation[___Rule[_String, _TemporalData]]] :=
"String->TemporalData";
f[assoc_ : Asssociation[___Rule[_Symbol, _TemporalData]]] :=
"Symbol->TemporalData";
f[assoc_ : Asssociation[___Rule]] := "_->_";
With[{ts1 = TimeSeries[{1, 2}], ts2 = TimeSeries[-{1, 2}],
v = VerificationTest},
{VerificationTest[f@<|"a" -> ts1, "b" -> ts2|>,
"String->TemporalData"]
, VerificationTest[f@<|a -> ts1, b -> ts2|>,
"Symbol->TemporalData"]
, VerificationTest[f@<|a -> ts1, "b" -> ts2|>, "_->_"] }] //TableForm
Attachments: