How Mathematica handles the "types" issue.

11 views
Skip to first unread message

Ted Kosan

unread,
Oct 17, 2011, 12:31:03 PM10/17/11
to mathpi...@googlegroups.com
I have been researching the "types" issue we have been discussing, and
here is one way that Mathematica handles it:

"You can easily create your own "types" of data in Mathematica. For example,
if you want to create a type that represents an integer modulo n, you can just
start using objects of the form ModularInteger[i, n,] The function
ModularInteger itself may do nothing. But you can use it as a "tag" to indicate
to other functions that the object you are using is of "type"
ModularInteger. You
can then define functions that act on ModularInteger objects just by specifying
rules in which the arguments of functions are patterns involving ModularInteger.
So, for example, you could give a rule for negate[ModularInteger[i , n ]] to
specify how to negate modular integers."
(http://reference.wolfram.com/legacy/v1/contents/4.1.5.pdf)

From what I can tell, MathPiper was heavily influenced by Mathematica
and I think it was also designed to handle the "types" issue this way.


Ted

Reply all
Reply to author
Forward
0 new messages