Re: writing programs
- To: mathgroup at smc.vnet.net
- Subject: [mg13466] Re: [mg13417] writing programs
- From: "Clemens Frey" <Clemens.Frey at uni-bayreuth.de>
- Date: Sun, 26 Jul 1998 02:33:30 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hi John! What about reading a book first ? (RTFM/RTFFAQ) If you want to program, read Maeder. Try to understand some basic principles about Mathematica before transferring this-and -that from other languages into Mathematica. This won't work, at its best, it will work badly. Some basic insights: - You can program Mathematica in whatever style you want: functional, procedural, object-oriented, list-oriented, pattern-matching... but there are BIG differences in performance; prefer working on expressions (not lists, as lists are expressions) as a whole instead of on their parts (so try to avoid recursive things...) - Always remember: You are working on expressions, WHATEVER you do: A list is List[...], a=2 is nothing else than Set[a,2] - neither ';' nor a blank line are separators like in C. ';' just prevents Mathematica from producing output - Think about what you are about to do. If you want to define a function, do it. If you want to evaluate the function, do it. But not all at the same time. These incremental things (defining and remembering) are nice stuff, but it's not at all the point in Mathematica. Clemens