Consider some example definitions:
abba["1"] = 1;
abba["2"] = 2;
For some reason, I do not want to introduce the other form of representation such as associations.
Is it possible at all to extract keys for which abba
takes the predefined values (i.e., "1","2")?
lookUp = ReplaceAll[ Merge[Identity] @ Map[Reverse] @ ReleaseHold[ DownValues[#] /. {RuleDelayed -> Rule, #[x_] :> x}]] &;
Use aslookUp[abba]@{1, 2}
,lookUp[abba]@2
etc $\endgroup$