Re: structs/records in mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg41783] Re: [mg41767] structs/records in mathematica
- From: "Hermann Schmitt" <schmitther at netcologne.de>
- Date: Thu, 5 Jun 2003 07:31:27 -0400 (EDT)
- References: <200306041234.IAA17798@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello Sidney, I implemented an oo system for Mathematica. In this system the status of an object is implemented as named variables in a list: e.g.an address: status = {name, street, town} In this way you can access the values by name or as part of the list "status". You may also have an array of classes e.g. an array of points. I have a quarrel with my internet service provider: netcologne.de and netcologne closed my web site. But I send you material about my oo system, if you ask me. Yours Hermann Schmitt ----- Original Message ----- From: "Sidney Cadot" <sidney at jigsaw.nl> To: mathgroup at smc.vnet.net Subject: [mg41783] [mg41767] structs/records in mathematica > Hi All, > > Currently I am involved in a project to read satellite data files into > languages such as IDL and others. We're also considering implementing > a Mathematica interface. > > For this application, we need the ability to represent classical > records/structs (as found in imperative languages such as C/Pascal), > having named fields with an associated value. > > Since such a type is not directly supported in Mathematica, we'd like > to know if there is a 'standard' way of handling this type of > situation. > > We're currently thinking of using a list of rules, e.g. > > data = { > id->"this_or_that", > value->17.3, > compound->{id->"compound_id", value->18.4} > } > > but this makes selecting a value a bit awkward: > > value/.(compound/.data) > > since this is syntactically the reverse of what one would expect in a > language like C/Pascal (data.compound.value), and the /. operator is > left-associative (therefore requiring parentheses in case of nested > structs). > > Is there perhaps a better way/standard idiom for handling situations > like this? > > Best regards, > Sidney Cadot > Science and Technology Corp., The Netherlands >
- References:
- structs/records in mathematica
- From: sidney@jigsaw.nl (Sidney Cadot)
- structs/records in mathematica