Re: Conventional way of doing "struct"-like things?
- To: mathgroup at smc.vnet.net
- Subject: [mg104605] Re: Conventional way of doing "struct"-like things?
- From: Erik Max Francis <max at alcyone.com>
- Date: Wed, 4 Nov 2009 01:41:20 -0500 (EST)
- References: <4047035.1257118894351.JavaMail.root@n11> <email@example.com>
David Park wrote: > I would prefer your second method because it seems more natural and is just > a mnemonic shortcut for Part. Such simple definitions can be quite useful. > The method is also easily extended to more complex structures with sub-lists > or even conditional sub-lists. > > As far as general Mathematica style is concerned you seem pretty savvy as it > is. You will probably get many suggestions so I'll throw in my two cents and > hope it doesn't too much conflict with the experts. > > 1) Prefer functional programming to procedural programming. > > 2) Localize variables in function definitions, With or Module statements. > Avoid setting Global values for simple symbols like x. > > 3) Keep things symbolic as long as possible. > > 4) You seem to come from a programming background. Just to nudge in a > different direction I would say don't think of Mathematica so much as a > programming language. Think of it as a piece of paper on which you are > writing and developing your ideas. Learn how to use sectional grouping and > text cells to provide discussion. > > 5) Build up generated knowledge. Write usage statements. Put developed > routines in a Routines section at the top of your notebook. Maybe you can > eventually transfer them from package purgatory to a real package. Thanks for the ideas. In fact, I'd been doing pretty much all of these as it was ... :-). -- Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis Every human being is a problem in search of a solution. -- Ashley Montague