Re: Abstract data types
- To: mathgroup at smc.vnet.net
- Subject: [mg14003] Re: Abstract data types
- From: "David Keith" <dkeith at hevanet.com>
- Date: Sat, 12 Sep 1998 16:59:24 -0400
- Organization: Hevanet Communications
- References: <6tbum2$mru@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I use the list method you describe. For example:
newDataType = { {labelString, dateString}, {xlist, ylist, zlist} }
Since Mathematica allows list structures to appear on the left side, I
process items from a such a structure passed to a function by using
{ {label, date}, {xlist, ylist, zlist}} = argument
Where label, date, xlist, ylist, zlist are variables private to the
module defining the function.
Dave
Morten N. Aasnes wrote in message <6tbum2$mru at smc.vnet.net>...
>Is there a way to make new datatypes in Mathematica? I have some
>routines for reading various sorts of data from files, along with some
>information about the data, like label to use for plot, axis labels,
>etc. And I would like to be able to treat all this like a single
>object. I supose I could just use a list, and have the first element be
>the data itself, the second element as the label, etc. and then have
>functions like setLabel/getLabel but this dosn't seem very elegant. Any
>ideas?
>
>--
>Morten Nygaard Aasnes mortena at ii.uib.no "Nothing's the same
>anymore" Fantoft Stud.By A626, (+47)55276131 -Sinclair
>in b5:"Chrysalis" N-5036 FANTOFT, NORWAY www.ii.uib.no/~mortena
><*>
>