Message Boards Message Boards

0
|
6297 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:
GROUPS:

Data Objects - InterpretTemplate

Posted 10 years ago
Data objects are being used with increasing frequency in Mathematica -- are there any guidelines or documentation for writing them?  For instance EmpiricalDistribution creates an object which looks like thi
 Cell[BoxData[
  TagBox[
   RowBox[{"DataDistribution", "[", "<<",
    TagBox["\<\"Empirical\"\>",
     Editable -> False], ">>", ",",
    TagBox[
     RowBox[{"{", "100", "}"}],
     Editable -> False], "]"}],
   InterpretTemplate[DataDistribution[#, {CompressedData["
1:eJxTTMoPSmVkYGBIAeJqkXXuD6ta7EfpUXqUxqQB3yJtZg==
     "], CompressedData["
1:eJwBLQPS/CFib1JlAQAAAGQAAAAACuJNTPNtP4D2QyNtd4I/wHTuASMwlj+A
saBELseWP8C42Tw6wZ8/YOS1i2sVpz+ABmN3wUGuP2DhPErS2LM/IDUe6Hsd
uj/g9dI3IDi+P0DKPKrv6MM/UOrUL9lIxD8wAHcavVnFPzDKdSsEk8U/8MN5
b93Nxz/AGigUqijIP/Ail6sQf8o/oE8lHo3NzD9g9v698QzPP8Q9UDMGwdA/
fJF11C3U0D9MZQz/h1PRPyDoRlTCrNE/1CTC6YHY0T9ohCW3mTzSPzxEcqty
kdI/vM7JRiKt0j90qO8pw4jTP1zduDHZrtM/eHbluQCF1D+gO7Y45AbVP+Bm
ym+rE9U/HJ6SZAxf1z84JfLeC9bXP+Q/+C03adg/qKUBLMSf2D+Usx/EYanZ
P/D7OARq39k/5Cdvs2Ec2j887je30cXaP6SOpyiHgds/0HNuAjRy3D/s6zal
L4XcP2QwJPVijdw/qK2EGcWh3D/gzylE0DDdPyBB2PEeF94/tIvFHgPh3j9E
oF+FsfPeP1iGhz70RN8/nCvRCztn3z/ARRf98X/fP1Cl0Rm2TuA/pKa0dlRQ
4D/YlhT2bJPgP7gp45OxIuE/2PVPPLSJ4T8W/sBPBIzhP76x2HxazOE/HjBx
R7q54j92qeOks8niP+yDw4dA2uI/HI1JlAU64z+ue/EGu9DjP7Z2j4rB5OM/
GASagYce5D96fncLLjzkP74W2rktU+U/ijUe/4VU5T8czkdBLQDmP2ROYJcz
d+Y/Vs4xf/WY5j9w+Nrt06PmP9akzIfz4OY/goWWuuhf5z/qkD0XWLrnPyqQ
g840vec/LvJz9JU66D9gPU6R5G/oP/4wikDSreg/XgmBYNi/6D9O+hCx9Cjp
Pyy2PmZajek/aub70Z4G6j/ONVEF3ObqP+qS6Dcfous/gqi07Cyt6z/0vIT7
QcjrP+JaBWGIzes/Qp4vTXE87D/QBTjjYHHsPz5JzfQUhew/TC75w+bq7D/i
aOrTpf3tP8KvJ4zoou4/SsQu8igv7z+4f/weFn7vP1iEqSfgtu8/6uaWYxvP
7z/8JJrjN+vvP+4cos0=
     "], False}, 1,
    First[#2]]& ],
  Editable->False,
  SelectWithContents->True,
  Selectable->True]], "Output",
CellChangeTimes->{3.6066746695093565`*^9}]

TemporalData gives a similar structure also using InterpretTemplate.  I would like to create similar objects.  I presume there is a function which will create this sort of thing, but there is no documentation that I can find on how to do it or use InterpretTemplate.  I suspect there are guidelines for developing these things.  If I create new objects, I would like to do it in a way which will be compatible with the rest of Mathematica.  Graphics cells in notebooks now also have similar structures, which are being created in the kernel but are interpreted in the frontend.  A pointer to some documentation would be nice.
Thanks.
POSTED BY: Robert Rimmer
The structure of these internal objects is often not documented because they are very likely to change in the future. Structures like this change a lot when the developers make algorithmic improvements, so instead of working directly with these objects it's best to work with the documented functions which produce them. The behavior of these documented functions isn't supposed to change significantly between versions of Mathematica.

That said, there are a lot of people who will figure out how these internal objects work and try to use them. They run the risk of their code not working in future versions. A common example of this in previous versions was Interpolation. The Interpolation function gives back an InterpolatingFunction expression. The structure of InterpolatingFunction expressions isn't really documented because it can change to reflect improvements in how Mathematica stores and evaluates Interpolations. Their structure changed significantly between versions 8 and 9. This caused some headache for the people who didn't use an abstraction layer like the one provided ontop of InterpolatingFunction.
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract