Hello! I find myself wanting to write functions that do a common WL thing: produce as their output an ‘object’ function which is then queried by sending arguments. The statistical fitting functions are an example: you get a ‘fitted model’ object from which you extract different outputs, e.g.,:
myFit["ParameterTable"]
myFit["AIC"]
But I can’t seem to find any examples of how these ‘object functions’ are coded within the functions that produce them. I can think of some ways it could be done, but I’m guessing there is a standard way that WL functions do it, and I would prefer to just copy that.
Does anyone know? Is there a template?